I worked out a solution. Maybe not the best, but here's what I did.
Needs to be in Immersive Space.
Enable world tracking via WorldTrackingProvider.
Create an entity (I parented mine to the main scene) and I called it "user".
Subscribe to SceneEvents.Update events.
When the update happens, use queryDeviceAnchor to get the position of the device (ie, the user).
Update the user entity position:
let transform = deviceAnchor.originFromAnchorTransform
user?.transform = Transform(matrix: transform)
Now when you place your new entity into the scene, just do this:
child.setPosition([0, -0.32, -0.53], relativeTo: user)
child.setOrientation(.init(.init(angle: .zero, axis: .y)), relativeTo: user)
First position the new child (of the scene) slightly ahead of the user and slightly down (or wherever you want to put it). The (0,0,0) position is inside the user's head, effectively.
Then change the orientation to 0º so it faces the user.
The new child is where I want it, but a little "wonky" in the X and Z axis - it has to do with the user's head tilt and I haven't figured out how to correct it.
Topic:
Graphics & Games
SubTopic:
RealityKit