WebXRCamera.realWorldHeight getter throws exception (Quest2/Oculus browser)

Uncaught DOMException: Failed to execute ‘getViewerPose’ on ‘XRFrame’: XRFrame access outside the callback that produced it is invalid.

Will look into that! I tried avoiding updating it on every frame, but there is probably no escape there.

Just a question - is it possible for you to use it inside one of the render loops? (inside an onXRFrameObservable for example))

1 Like

Yeah I suppose we could wait for the next frame before executing the movement.

The only other solution I have is something i tried avoiding - updating the value on each frame. I will need to check the perfs costs before actually doing that (or might add a flag in the camera to update height on each frame).

I’ll give it a shot, thanks

1 Like

I think the frame observer would have worked fine, but I ended up using getOffsetReferenceSpace directly because trying to set the rotationQuaternion of the WebXRCamera resulted in what seemed to be my desired orientation being combined with the player’s current head orientation so that the world would go topsy-turvy if my head wasn’t perfectly level when I clicked the button. Using reference spaces, I no longer needed to apply any height offset.

1 Like

Oh, that’s a much better solution for the use case :slight_smile: