Using WebXRDefaultExperience.CreateAsync() Camera drops to the floor when using the WebXR Emulator

Using the WebXR emulator browser plug-in, the camera drops to the ground when calling BABYLON.WebXRDefaultExperience.CreateAsync() How do I set the default height of the camera in my scene with the XR camera - setting the camera position in the scene has no effect.
Any suggestions?
Thanks,
Michael

const options = { 
   floorMeshes: floors
};

const xrExperience = await BABYLON.WebXRDefaultExperience.CreateAsync(scene, options);

Hi Michael,

Hope this would be useful for me. I made the PG and confirmed VR player position was changed when entering XR.

https://www.babylonjs-playground.com/#W9IVC9#7

I just made a change to the PG to set the initial height, but to no effect.
https://www.babylonjs-playground.com/#W9IVC9#10

The documentation at WebXR Experience Helpers | Babylon.js Documentation
is incorrect where it shows an example. WebXRCamera does not have a y property.

xrBasicHelper.onInitialXRPoseSetObservable.add((xrCamera) => {
    // floor is at y === 2
    xrCamera.y = 2;
});

I think you mean cam.position.y

1 Like

yes, this should be xrCamera.position.y

I would anyhow recommend setting your ground at 0 to begin with (and not set the user’s y position), as you still have the user’s height to consider. XR starts with groundLevel = 0 and then adjusts the XR camera’s position accordingly.