Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Possible to use peer-to-peer proximity ping as input on game levers in mobile?

Discussion in 'AR' started by banjoFrette, Mar 13, 2024.

  1. banjoFrette

    banjoFrette

    Joined:
    Jan 29, 2024
    Posts:
    18
    Hey everybody,

    I'm an artist building out an art project in Unity 3D and am reposting this question after it was deleted from a different topic:

    I'm interested in building a feature into my (mobile, mostly) games that allows device proximity to act as an input on various game levers and influence game objects. I know peer-to-peer offers security risks so please note there's already plan to mitigate that with some web3 tech allowing for trustless communication between authenticated devices.

    In regards to proximity inputs, I originally approached it from an Input Manager perspective wondering if there is a way for the trustless ping between devices to act as an Input and trigger/push/pull game levers but apparently, from the Mods perspective, it was "wrong" and the thread got killed. Although it's possible the Forum Mod misinterpreted my idea so apologies if I'm still mis-posting as I didn't get any official feedback other than from another user who suggested AR.

    It feels like a viable avenue to explore but I'm not building an AR or VR game: it'll be passive (mostly) top-down 3D with most of the game's evolution coming from trustless peer-to-peer proximity pings acting as inputs.

    I could see how a possible AR component comes into play but all the tutorials I could find either focused mostly on camera filters or haptic feedback, neither of which feature in my games design schema.

    Does any anyone have any suggestions or places to look in the Unity scripting library? Specifically interested in turning the trustless proximity ping into input on the game lever (..but I do already know the "trustless" aspect is a separate issue that gets resolved on-chain).

    I'm probably not looking hard enough but if anyone has any suggestions or C# reference it is appreciated.

    (Also worth noting that that previous, deleted, forum topic had an open bounty attached. Thanks to the confusion surrounding the previous thread's deletion the open bounty has been partially rescinded but if anyone has any viable contributions know that there is a (modest) amount of kibble in the cupboard, so to speak ;)
     
    Last edited: Mar 13, 2024
  2. WyattBUnity

    WyattBUnity

    Unity Technologies

    Joined:
    Mar 27, 2023
    Posts:
    52
    I'm not entirely sure on what your whole idea is, so I can't comment on the exact details, but as far as driving input, the input system itself may be useful to you here Input System | Input System | 1.8.0 (unity3d.com) it can function as an improvement to the original input manager method for input in unity.
     
    banjoFrette likes this.
  3. banjoFrette

    banjoFrette

    Joined:
    Jan 29, 2024
    Posts:
    18
    Thanks for your reply. I did originally post this query in the input systems category but with the confusion surroudning that deleted post I appreciate the helpful clarification as I'm narrowing in a solution.

    As you may have noticed, I started a private conversation with you sending more details. I'm assuming it won't be this easy but I'd like for any solution to be open source so feel free to share any code suggestions here if there's actually a "simple" solution.

    Thank you again.

    B
     
  4. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,100
    Note our FAQ:

    Please do not send direct messages to Unity employees on the forums.
     
    banjoFrette likes this.
  5. banjoFrette

    banjoFrette

    Joined:
    Jan 29, 2024
    Posts:
    18
    ok, thanks!




    Thank you for your thoughts and your time!
     
    Last edited: Mar 26, 2024
  6. banjoFrette

    banjoFrette

    Joined:
    Jan 29, 2024
    Posts:
    18

    Andy,

    Also, as you may have noted, I'm having trouble finding the correct topic for this query. It has already been, possibly incorrectly, deleted once without notification from the Inputs category, but unless I'm not reading between the lines and there is an AR solution here, I think that original deletion from Inputs category was a mistake and it is the best spot for it.

    I appreciate your time so far: do you have any suggestions or helpful tips?
     
  7. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,100
    I don't fully understand you question. Are you asking how to compute the distance between two devices in an AR session? Once you have a distance value, you can write any C# script you like to make this control levers, etc, in your app.
     
  8. banjoFrette

    banjoFrette

    Joined:
    Jan 29, 2024
    Posts:
    18
    I suppose I am asking that, but it generated a few more questions:

    I'm curious is it possible to do that without engaging any additional AR functionality?

    My project's privacy-centric and doesn't need cameras or camera inputs so is it possible to cherry pick what's used in this regard?

    And if yes: sure, how *do* you compute the distance between two devices in an AR session?
    And how much privacy does that offer the respective users?

    Can a person's exact location be triangulated from this data if bad actors are trying to use the game maliciously?

    And can that distance be calculated locally without sending any information to a server?

    And might as well through it out there: are there any other ways in Unity to compute distance between two mobile users?

    I know there's some unknowns complicating my questions, and I'm sure there's enough question marks in the above what I'm asking is complicated enough as it is, but please let me know if you would like any additional clarifications or have any questions in return. Thanks!
     
  9. AliceMUnity

    AliceMUnity

    Unity Technologies

    Joined:
    Feb 28, 2024
    Posts:
    9
    To me, it looks like the general question you're asking about is localization: determining a device's position in 3D space relative to other devices. @jstan-unity wrote a few suggestions for how to do so over on this thread. The answers to your privacy related questions depend on the exact method you use to localize, but to my knowledge most off the shelf solutions use camera data.
    Edit: Link fixed.
     
    Last edited: Apr 11, 2024
    banjoFrette likes this.
  10. jstan-unity

    jstan-unity

    Unity Technologies

    Joined:
    Sep 15, 2023
    Posts:
    18
    banjoFrette likes this.
  11. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,100
    Generally yes, depending on your definition of "engaging AR functionality". In many cases AR features can be individually enabled or disabled: https://docs.unity3d.com/Packages/c...managers.html#enabling-and-disabling-managers.

    All AR platforms that Unity supports calculate their position using one or more device cameras. If you don't want the camera to be used, you are talking about a project that does not involve AR.

    Of course. GPS, wifi, bluetooth, sending self-reported location information over the network, etc. But none of these are AR solutions. This is the AR forum, so if you don't have an AR question then please redirect your questions to an appropriate forum.
     
    banjoFrette likes this.
  12. banjoFrette

    banjoFrette

    Joined:
    Jan 29, 2024
    Posts:
    18

    Thank you all for your replies. I think it's clear I'm going to need to find a different solution to the build, as I'm working to create a mobile app that does *not* include camera permissions.

    However, I greatly appreciate your time, and the clarifications and effort that went into this thread, so far, have helped me to learn more about what's possible, and I'm very grateful for the opportunity to be learning and growing withing the Unity ecosystem.
     
    andyb-unity likes this.