Switching between WebXR and normal 3D view

I’m working on a game that I want to work in VR and standard 3D. This was pretty much supported by default with WebVR, but now I need to move to WebXR since WebVR is being deprecated.

To save me hours and days chasing a red herring, can anyone tell me whether this is possible and what would be best practice to implement it?

Many thanks in advance

Hi @CarlBateman!

@RaananW, who is behind the WebXR implementation in Babylon.js updated the documentation. You should find what you need in these sections: Getting started and Migrating from WebVR

Let me save you the time:


And now I have a question to make sure I understood correctly :slight_smile: - Are you asking about a form of a viewer mode when IN xr, or are you asking about a game that will work on desktop, will enter XR, and after exiting XR will continue working on desktop? (A simplified answer to that would be - 1 is not possible yet, 2 is exactly what we have).

I think I need to understand the usecase and then will be able to provide a much better answer

Thanks for getting back to me.

Desktop - standard view (VR for testing only)
Mobile - toggle between VR and standard view

I’ve installed the WebXR API Emulator, which has helped enormously. I think the WebXR implementation will do what I want, it’s just migrating and getting my head around promises that’s the the killer.

Promises are fun! Once you accept them as a solution for the async nature of life, the universe, and everything. And XR.

The try async-await pattern, it eases up the migration to promise-based architecture.

If there is anything we can help with, let us know.

1 Like

People quoting Douglas Adams are great people