Search Unity

Question Instantiate object at a certain direction of a spatial anchor

Discussion in 'Prefabs' started by andygoh2010, Jan 10, 2023.

  1. andygoh2010

    andygoh2010

    Joined:
    Jan 10, 2023
    Posts:
    1
    Having a spatial anchor as a reference point, I wanted to create an object that does not change its location that reference to the spatial anchor.

    When creating and saving the initial location of the object that will be spawned later using prefab. I make use of the difference of the x,y,z coordinate between the spatial anchor and the object and saved it in the cloud. After that, making use of the difference of the x,y,z to load the prefab back to it original position.

    Screenshot 2023-01-10 094124.jpg

    However, upon restarting the application at a different point, the prefab will be shifted based on the start up position of the hololens. Based on what I know, the initial position of the hololens when it starts up in (0,0,0). Hence, the spatial anchor coordinate will be different and causing the prefab to be loaded at a different direction.

    Screenshot 2023-01-10 094725.jpg

    Is there any way or solution that I can implement to make the prefab load at the same place as where it is created without it being affected by the hololens location?
     

    Attached Files: