XR feature works but the baseExperience variable is empty (Undefined)

When I test the baseExperince variable on my XR application in https, the variable is not created (undefined). Yet I do have the interface to switch to VR mode. I tried with version 4.1.0 and 4.2.0 Alpha 17.

If I do the same test in the playground with the basic scene, it is well created.
I’d like to understand before going further, because I’m afraid to have problems afterwards.

Do you have an idea where it can come from?

Pinging @RaananW

1 Like

Hi, make sure you serve your site using https, otherwise XR will not work. Could that be the issue?

Hi Raanan,

Yes, the server uses https, screencast + console FF:

and Chrome

Thank you for your first quick return, I’m still searching on my side, waiting for your return.

firefox doesn’t support XR, so this is the reason it is not working :slight_smile:

They are working on it. In the meantime you can use the webxr polyfill, or the webxr emulator to test your scene

Oh, I thought I read XR was supported by FF :upside_down_face:
Under Chrome, I have the XR polyfill which starts when my app is on a https server.

But I have the baseExperience variable equal to Undefined. :sleepy:

how do you check for xr support? chrome (latest stable) has xr support natively, and the emulator makes sure xr is available as well.

With the code find here The WebXR Default Experience Helper

this is an async (promise-based) call, you will need to either use async-await, or use .then(xr=> {...}) to get the experience helper. baseEpxerience will only be available after this resolves.

It is all described in our documentation, you can find the into here - The WebXR Experience Helpers - Babylon.js Documentation


I have just corrected the code and I now get a value for xrHelper. baseExperience. Thank you very much for your quick help.

1 Like