createDefaultVRExperience + useXR: no enterVR after enableTeleportation 🤔

I am coding for Oculus Quest mainly, but also for all VR-Devices.
As WebXR ist not everywhere yet (like in iPhone) I use createDefaultVRExperience with useXR.
I can’t check for xrTestDone and call enableTeleportation at once!
Is there a way to call createDefaultVRExperience asycron?

See for my work around.

This runs fine, including enterVR after 5 seconds.
But if I uncomment enableTeleportation, enterVR does not work in my Quest. My fould? :thinking:
(It works in MacOS Morzilla with add-on “WebXR API Emulator”)


my best recommendation for you would be to use the XR ployfill and use the WebXR experience helper instead of the VR one. useXR will create an xr experience under the hood which you can control after initializing, but as you found out - without proper async changes to the VR Experience helper, it will be hard enjoying all of the benefits.

I don’t quite understand the playground - is this setTimeout working on different devices? You usually can’t enter VR outside of a user input event

Thank you for your help.

Yes, I should use WebXR explizitly. But as I need to support WebVR-only-devices, I need do check if WebXR is supported. I assume, just create the XR helper will tell me.

The enter&exit works fine in Firefox, Oculus Quest, iOS and Mac Firefox.
But it is just a test. I will enter at once and may add an user-action to exit later.

WebVR-only devices can be supported using the polyfill (until firefox decides to fully support XR).

I think the only real issue is iOS (gotta love apple).
I would detect XR support and use the XR experience helper, and only fallback to the VR helper if the device has no WebVR support (as the VR experience helper also supports device orientation devices)

I now know about “polyfill”. In Germany we could call it with our main product “Moltofill”: filling a gap.
To (partly) “simulate” WebXS by WebVR and Javascript code is clever.
There is no way to use it in a Playground, is there?

There is even a fallback to cardboard, as I need it.
Some odd things appeared, I will have more questons (left/right exchanged?)

Well, now I have to replace all my WebVR code!
There will be more questions now (like how to set the realWorldHeight for monitor mode)

1 Like