Holographic button panel tilt-locking in WebXR

Hi there…

https://playground.babylonjs.com/#S1UH7X#18

I know we’re locking the holographic button panel to the camera using…

panel.linkToTransformNode(xrHelper.baseExperience.camera);

Wondering though if there’s a way to lock the z-axis (I think) rotation in VR, so if I tilt my head to one side the button panel will stay locked with the horizon instead of tilting with my head/camera. I was thinking maybe I can override the z-axis rotation using the scene.beforeRender function? Anyhow…I’d like to try that if possible to see what it feels like. Thanks.

Hi @ssivulka,

I assume you mean that you only want the rotation on the Y Axis. one way to achieve this is to only take the y rotation of the camera’s transformation, and apply it to a different transform node:
https://playground.babylonjs.com/#S1UH7X#24

1 Like

Works great thanks. I tweaked the code to also support X Axis rotation. That way I can look up and down and have the menu panel follow me. The Z Axis just felt weird following me.

2 Likes