Search Unity

Unity ARCore multiplayer world sync

Discussion in 'ARCore' started by aefox, Sep 12, 2018.

  1. aefox


    Sep 12, 2018
    Hello everyone,

    I'm doing some research with Unity and ARCore. Here's what I'm trying to achieve:
    1. the first player is in a room, starts the app, navigates around to get arcore to recognize the space
    2. the first player then creates a "game session" and places a cloud anchor in the room's space
    3. the second player is in the same physical room as the first player, starts the app (on his own device) and moves around to also recognize the space in the room
    4. the second player then connects to the existing "game session" (they're in the same network)

    Here's where things get fishy and I need some suggestions:
    - at step 4, when the second player connects to the same "game session" I would expect the cloud anchor to be correctly positioned in the room; but it isn't; even more, if the second player moves around, the cloud anchor also seems to be moving
    - Q: has anyone else noticed this? does anyone know how/why is this happening and what should I do to fix it?
    - when the second player joins the "game session" I would be interested to actually add this player's current location (actually his phone position is more correct I would assume) in the room to the "world" of the first player
    - Q: anyone did this? maybe not possible and every device has its own world coordinates?
    - Q: what I am ultimately interested in (initially) is if I can get the distance between the 2 phones (I guess cameras would be a correct way of putting it); maybe this approach with syncing the 2nd world to the 1st one is not applicable/good? anyone got any other ideas how could I achieve this?

    Extra notes:
    - both players are on the same network and both have Google Pixel 2 XL phones
    - I've started from the unity-arcore cloud anchors sample but I am currently stuck with the problems mentioned above

    Hopping for some insights.

  2. kushal81


    Jul 20, 2017
    Actually , I m also working on similar type of project can you share project details with me if you don't mind sharing it??