Search Unity

Third Party Photon 2 - Positioning a gameObject on all clients in different places

Discussion in 'Multiplayer' started by smasters654, Jun 10, 2020.

  1. smasters654

    smasters654

    Joined:
    Dec 20, 2013
    Posts:
    46
    I am trying to spawn a bomb from a player in my multiplayer game in AR. The reason I mention this is because when I place my AR arena its in one position but the other player may place theirs somewhere else and the arena positions are different.

    The bomb does not have a photon view on it so when I press the bomb button I have, I send an RPC with the bombs position to all clients. Then I subtract the arena position that was placed from the sent bomb position and spawn the bomb. I am doing something wrong because the bomb is not in the correct position on any of the clients when it spawns. Is there a certain formula for this that I am missing? I feel like there needs to be a relative or shared point I need to compare to.

    Thanks for any info!
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    You got 2 coordinate spaces: One is in the room and one is the scene, relative to the anchor / center.
    If you send the scene position to the other player, you don't need to calculate anything else, I think.

    In doubt, implement different calculations and show each with a different color. Pick the one that is correct.
     
  3. smasters654

    smasters654

    Joined:
    Dec 20, 2013
    Posts:
    46
    Thank you for your reply, I ended up getting a reply from someone on a different forum with a way to set my AR content at world zero and still make it look like the AR placement was acting normally. I used the MakeContentAppearAt method to set the world origin, so I didn't have to do any unnecessary calculations.
     
    tobiass likes this.