Webxr camera rotation-position and old camera rotation-position

Hi
I want the camera to get its final rotation and position after WebXR runs. But it resets after WebXR runs. Can you help?

cc @RaananW the king of all the …R

You need to understand the flow of observables in order to make it work correctly. I assume this is what you wanted to achieve:

WebXR basic example with teleportation | Babylon.js Playground (babylonjs.com)

Every time an XR session, run this code on the next frame.

No, I mean
With the camera angle like this, I start the XR.

Camera angle resets when XR starts

But what I want is for the XR to pick up the previous camera angle when it starts.

Mister Jedi, is that possible?

That should be the default behavior. Or better yet - that is the default behavior :slight_smile:

The default behavior is to take the position of the desktop camera and the rotation on the y axis when entering XR. if that’s not the case please try reproducing it and show us when it doesn’t work.

Note that you are overriding this behavior when you set the camera’s position on your own.

If I misunderstood, please try me again :slight_smile:

1 Like

The information you provide is valuable to me, thank you for sharing your information. Actually, that’s exactly what I wanted. Getting both the position and rotation of the old camera after opening the WebXR screen. He’s just taking his position now. How can I change the direction the WebXR camera is facing when WebXR is turned on?

This happens automatically. The rotation on the Y axis is applied to the webxr camera when you enter XR in VR mode.

If it doesn’t I will be happy to check a reproduction. On the playground would be the best :slight_smile: