Search Unity

Question AR Foundation + Photon, alternatives to cloud anchors for sharing object position?

Discussion in 'AR' started by Akaton97, Nov 25, 2022.

  1. Akaton97

    Akaton97

    Joined:
    Jun 26, 2017
    Posts:
    6
    If this question has already been made or aswered, i'll delete the post immediatly and beg your pardon.

    tl;dr:
    i'm using AR Foundation and Photon, how do i share an object position from a "host-user" to a "client-user" INSTEAD of using cloud anchors?

    long version:
    So, i would like to create a card game that exploit AR Foundation technology, in particular AR Core since i am developing on Android, and Photon as a multiplayer Engine for multiple users to play together.
    My object is to create a "peer to peer" alternatives to Google Cloud Anchors system, for making a comparison later on, but i don't know how to "share" the anchor of the main object for playing (which is a Table, by the way).

    here is what i would like to happen:
    1) a user connects to the game, type "host a game" and is sent to "ar placement scene"
    2) than he/she places the card table on a x position (intersection between plane and touch, that works perfectly)
    3) after some adjustments (local anchors are created and destroyed if "adjust" is typed), he/she types "play" and the AR Placement manager is disabled, Photon tries to search a room but end up creating one.
    4) the "host" waits for someone
    5) "someone" arrives, but the "AR Placements Manager" has been deactivated in Lobby because he/she clicked "quick match".
    6) game manager search an available room if quick match is pressed and "someone" joins it
    7) the "host" send an "anchor" (or whatever it may be) for placing the table in "client" 3d world using in the same exact position as the host-one
    8) the game begins

    Now, my question is if it is possible to make an alternatives to cloud anchors? (POINT 7) even without anchors, a world position may be enough i think. I'll try to manually add an anchor later on by "add component" if it works. but if it is stable enough, it would be fine even without an actual anchor. I can send data with Photon, but not complex one like gameobject or anchors. Vectors are allowed.

    I hope that everything is clear, i'll explain better in case or change the main thread.
    Thanks in advance.
     
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,051
    To build something like this you would need a way to localize both players into the same coordinate system. Note that ARCore does not provide an implementation of this out of the box.

    The simplest way to achieve this would be to use a known object, like an image marker that you could place on the table, then use Photon to have both players to send vector offsets from their shared world origin (the image).

    A more sophisticated implementation that doesn't rely on a known image would likely require a 3rd-party multiplayer AR tracking solution such as Niantic ARDK.
     
  3. Akaton97

    Akaton97

    Joined:
    Jun 26, 2017
    Posts:
    6
    Thanks for the reply!
    If i get it right, and forgive me if i am wrong since i am quite new to unity, i should send the transform.position of table (or a gameobject used as tracker for 3D table) to other players? i'll try it today and see what happens.

    Regarding Niantic ARDK, is it possible to integrate in AR Foundation and how much time it would require? or should i re-do the project using only niantic ardk?
     
  4. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,051
    Unity does not support using Niantic ARDK with AR Foundation, and you should expect errors at runtime if you try to use both in the same project.
     
    Akaton97 likes this.
  5. unnanego

    unnanego

    Joined:
    May 8, 2018
    Posts:
    199
    It does now.
     
  6. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,051
    To be clear, ARDK 3.0 is rearchitected on top of AR Foundation. ARDK 2 remains incompatible.