I’m trying to take users from one common room from an independent room per user. For quest users the transition between two different webxr apps is quite manually done, since the user must exit the current webxr app in order to see the second one that was opened as a second tab. Is there a way to switch different webxr apps?
Original Post on Discord
by user 939271426349862963
I believe you mean staying in VR when switching from one to another independent web app?
There’s a sessiongranted
event for the immersive web. If that’s set and you navigate from one URL to another you can stay in VR. If you enter VR using the button that our WebXR
component creates that is already setup for you (so if you have two web apps built with needle engine you should stay in VR)
@herbst🌵 made a PR for that a while back to add it to vanilla three too: [Feature] `sessiongranted` support for VRButton to enable in-VR navigation by hybridherbst · Pull Request #23110 · mrdoob/three.js · GitHub
I believe there has been a bug in e.g. the quest browser where this stopped working tho but I’m not 100% sure right now what the state of it is.
Does that answer your question?
You may need to enable the feature in your quest browsers chrome:flags
to try it
It should work in the Quest browser in Needle Engine, yes
yes, what I’m willing is to stay in VR when I switch webxr apps. And I am also using the VRButton, but not sure how to switch the webxr apps without doing it manually
by user 939271426349862963
I tried the example on the link above, but not sure how to switch rooms, tried with all the keys and clicking on the 3d object
by user 939271426349862963
Simply change the page href or make a link and call click on it from code
In the example you can just walk through the portal in VR if i remember correctly
If the target page supports sessiongranted (and all Needle Engine xr apps do) you’ll simply stay in VR
There’s a few additional (undocumented by Meta) rules regarding loading time etc, how long is an app allowed to load before the XR session is actually started
So try to keep the initial page slim and leverage additive loading (eg. nested Gltfobject in Needle Engine)
I was trying to open the link with this, but that only opens the webxr on another tab window.open(webxrurl);
by user 939271426349862963
and yes, I remain in VR, but also remains on the current webxr app, should I do other thing to load the other webxr app?
by user 939271426349862963
window.open(webxrurl);
opens a new tab, what you need to do is navigate in the same tab using window.open(webxrurl, "_self");
or window.location.href = "webxrurl";
I tried with window.open(webxrurl, “_self”) and that takes me out of the quest browser and opens the second webxr app on the current tab, must hit enter vr a second time to enter vr
by user 939271426349862963
I’ve tried with the second option and takes the same path
by user 939271426349862963