Instantiating an object at the same position in two different devices using Google AR Core

Hi,

I am trying to instantiate a networked object by tapping on detected plane in an app that uses Google AR Core. In the master device, it is instantiating properly but in other clients, it is spawning at (0,0,0).

Any leads will be appreciated.

Thanks in advance.
Hebin

Comments

  • Hi @hV4,

    to instantiate an object across the network, you have to use PhotonNetwork.Instantiate and pass a few parameter to that function. The first one is the name of the prefab which you want to instantiate. The prefab has to be inside a Resources folder. The second and third parameters are the position and rotation of the object. After detecting a tap on a plane, you would have to pass the position (and rotation) you need to the function. The fourth parameter describes the Interest Group the object should be instantiated in. You should use the default group 0 here.
  • Hi @Christian_Simon

    Thanks for the reply. I know how to instantiate the object and I was able to instantiate at the touch position in master device. But in the client device the same object is instantiated at (0,0,0).

    Can you provide some insights for that? I am using Google AR Core.

  • You can add a Debug.Log call to the Awake / Start function of the instantiated object and see, if the object's position is correctly applied after being instantiated. If it is correct, it has something to do with AR Core. I'm not sure how and if at all this affects world coordinates. If it is incorrect, we would have to take a closer look at it.