OpenXRCompositionLayer not following XROrigin3D / XRCamera3D rotation

Godot Version

v4.3.stable.mono.official [77dcf97d8]

Question

I’ve added an OpenXRCompositionLayerQuad to my player scene and it shows up correctly and follows me as I move around, but it doesn’t seem to follow any of the XROrigin3D rotation. Is that expected behavior? I’m just using it to display some debugging info so it’s not the worst, but I would’ve expected it to stay in the same place relative to the headset.

The composition layers are presented in local space of the origin, as they are rendered on the headset they have no knowledge of placement in your virtual environment.

So I’m not entirely sure what is not working as expected here. If you rotate the XROrigin3D node, you rotate the play space in the virtual environment, in effect rotating the player within that environment. The composition layer will seem to rotate with the player, and thus remain in place relative to the player.

Sorry, I realized that disabling my code removes the part where it follows my movement. I’m following the example at Room scale in XR — Godot Engine (stable) documentation in English (specifically using the Character Body Centric solution) so I am rotating a top level CharacterBody and then unwinding the XROrigin rotation. Is that possibly part of the problem? Do I need to apply the unwinding to the composition layer as well?

Essentially if I move my body physically around my space, the composition layer follows me, but if I physically turn around it stays where it was and ends up behind me. I’m not sure if we’re on the same page about that being correct behavior or not. This is kind of hard to describe :smiley:

I was wrong, if I move using my controller it follows me but if I move with my physical body it does not. So it seems like it’s completely detached from that piece.

Code for all of this

I was wrong, if I move using my controller it follows me but if I move with my physical body it does not. So it seems like it’s completely detached from that piece.

This is correct behaviour.

When you physically walk, the origin point is stationary, and the composition layer stays where it is as well, it is purely your camera that moves as it tracks your physical movement.

When you virtually move (by using your joystick on your controller), you are moving the origin point through your virtual work, and everything attached to the origin point, your controllers, your camera, the composition layers, all move with that.

Ok, I think after reviewing everything again that all makes sense. Am I correct then in saying that in order to keep the composition layer in view, it has to be moved in code to match the camera’s transform, relative to the origin?

I confirmed that plan does work, it stays in my view now. What I’m wondering, and this may be a dumb question, but why does the XRCompositionLayer need to be a direct child of the XROrigin? Is that a limitation of the XR system, or is it just a “for now” thing? I would think it should be safe to put it under anything that has that same requirement (Camera, Controller, etc).