WebXR - Manually Update VR Camera Position

What is the best way to manually update the WebXR default experience helper camera (WebXRCamera) position at runtime. I would like to place the the WebXRCamera in the cockpit of a race car for a VR racing style game.

If i just parent the WebXRCamera to the car and offset to be driver eye level… The position of the vr camera never moves.

If i get the global position of the driver in the cockpit and manually set the WebXRCamera.position every frame… its real choppy and the car mesh stutters

What is the best way to move a VR Camera manually via code and how come you cant parent the vr camera and move that parent transform and the vr camera should update its position as a child… right ?

1 Like

Adding @RaananW

The XR Camera doesn’t support parenting (yet!). You will need to update the position of the camera on each frame. It will be interesting to see how high-speed vr positioning change will work.

I will be working on adding webxr to the parenting system. The reason it is not working is that webxr is technically providing us with the view and projection matrices, so i initially didn’t want to change them. But it does make sense to allow the camera to attach to a different node.

1 Like

Yup, vehicles I think will be a very big deal. Or heck, just standing on any platform that moves relative to the world around you.

So… Moving the camera position per frame lags behind global position. Gonna need to parent the WebXR Camera to do something like VR Racing :frowning:

yep. Agreed :slight_smile:

On the todo list.

1 Like

[XR] add the ability to set the parent of the XR camera · Issue #10593 · BabylonJS/Babylon.js (github.com)

1 Like