You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, my question is: Instead of dragging prefab into the inspector and instantiating it, how can I place a gameObject in AR scene?
So I would like to load a gameObject from a scene into my AR scene. The AR scene will automatically detect for the plane. Once a plane is detected, the gameObject loaded should be automatically placed on the plane. The code I found uses prefab and instantiate like this
placedObject = Instantiate(placedPrefab, arPlane.transform.position, Quaternion.identity);
However, if the placed prefab is of type gameObject (basically I dragged the gameobject loaded), it didnt work. the gameobject was floating in air instead of following the detected plane. Do you know whether it is possible to achieve my desired scenario? Why is the position of gameobject wrong when I drag an existing gameobject in the scene instead of prefab?
Hi, my question is: Instead of dragging prefab into the inspector and instantiating it, how can I place a gameObject in AR scene?
So I would like to load a gameObject from a scene into my AR scene. The AR scene will automatically detect for the plane. Once a plane is detected, the gameObject loaded should be automatically placed on the plane. The code I found uses prefab and instantiate like this
placedObject = Instantiate(placedPrefab, arPlane.transform.position, Quaternion.identity);
However, if the placed prefab is of type gameObject (basically I dragged the gameobject loaded), it didnt work. the gameobject was floating in air instead of following the detected plane. Do you know whether it is possible to achieve my desired scenario? Why is the position of gameobject wrong when I drag an existing gameobject in the scene instead of prefab?
Thank you in advance!
Below is my code but it didnt work:
The text was updated successfully, but these errors were encountered: