Hi,
Is there a way to detect that the browser supports the immersive mode (I mean that the page is rendered in the browser of an oculus quest, for example) and then jump in the immersive mode automatically ?
So that the user don’t have to click on the helmet icon…
Thankx
I don’t believe you can do this. I think the browser requires the click or another “transient activation” as a matter of policy, similar to how user consent (usually in the form of a click) is required to play sounds on mobile browsers and things like that. This helps prevent rogue websites from preemptively forcing you into an immersive view when maybe that wasn’t what you actually wanted to do.
I haven’t done this myself, so I don’t know exactly how it works, but I believe the uiOptions configuration variable can be given custom buttons you can use for starting/stopping WebXR. For immersive, only starting should matter, I guess, but either way I think this capability allows you to override the default enter/exit UI with any custom UI you want. Hope this helps, and best of luck!
I’m making progress… but I just cannot make my custom button launch the immersion :-/
I made a simple playground to illustrate, if anybody has an idea… https://playground.babylonjs.com/#9K3MRA#639
the disableDefaultUI flag set to true means that you will take care of the entire UI generation. If you want to pass buttons and have babylon set the click event on them, you need to remove the flag from the configuration: