xrHelp.baseExperience.exitXRAsync => stuck in BABYLON.WebXRState.EXITING_XR

Recently ran into an issue that might be a bug. If you call xrHelp.baseExperience.exitXRAsync() when not in WebXR mode, BABYLON gets stuck perpetually in BABYLON.WebXRState.EXITING_XR. You cannot subsequently enter XR when you click on the XR helper button. Here’s a playground example:

https://www.babylonjs-playground.com/#I0QDTA#4

On the other hand, if you first check to make sure you are not in XR mode, you can avoid this problem. Like this:

if (xrHelp.baseExperience.state === BABYLON.WebXRState.IN_XR) {
    xrHelp.baseExperience.exitXRAsync();
}

Why not have xrHelp.baseExperience.exitXRAsync() check this internally?

Thanks.

Adding our VR GURU @RaananW to look into it.

Hurrah for state machines!

because it was simply not done? :slight_smile: I guess I never encountered this since I never called exit VR in code myself. Apart from a spectator ruining someone’s experiencing by exiting their experience or a VR user that has a GUI button to exit VR (instead of the dedicated button) I don’t see why you will need to call that…

Having said that - this is clearly a bug and I will fix it asap.

1 Like

PR submitted - exit allowed only if already in XR by RaananW · Pull Request #7791 · BabylonJS/Babylon.js · GitHub

1 Like