Game objects not spawning relative to headset

I am in the process of creating a mixed reality game for the Meta Quest, and I am currently trying to get a sword to spawn in front of the player which they can grab with the ray interactor. However, the sword is spawning in a completely different room of my house, where I initially built the game to my headset. The sword object is not a child of any other objects and is set to position (0,0,2), so I am unsure why it is spawning relative to a different geographical location than where my headset currently is. Does anyone have ideas as to what the problem could be?
Things I have tried that have not worked:

  • Adding brand new 3d objects to the hierarchy and rebuilding (same result)
  • Deleting the app off my headset and building to it again
  • Deleting and re-adding AR Session object

Screenshot 2024-07-21 at 3.59.03 PM

Unity’s world space coordinate system has no relationship to the headset position. The position of the headset is the position of the Main Camera GameObject in this screenshot. So you should spawn relative to that position, not relative to Unity’s world space origin.

1 Like

Another option in addition to what @andyb-unity said is to create an Anchor in the world and use that as your reference point. You can save and load anchors so that they persist between sessions. However you’ll need to set up the initial position the anchor is created by having the user place it someway like with a raycast with the controller or relative to the users HMD position when starting the app.