mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.69k stars 35.37k forks source link

webXR button does not switch to third state when fullscreen VR is exited using the controller #29457

Closed andrewhodel closed 1 month ago

andrewhodel commented 1 month ago

Description

The webXR button does not switch states when fullscreen VR is exited using the controller.

If you click the XR button to start fullscreen, then exit fullscreen by pressing a button on the controller the button still says enter while the standard nomenclature of the Oculus browser says resume in the browser placed button near the address bar.

Reproduction steps

  1. View a WebXR example with a VRButton using a VR headset and controller.
  2. Start fullscreen by clicking the VRButton.
  3. Exit fullscreen, the button is still in the "start state".

Code

NA

Live example

Screenshots

No response

Version

168

Device

Headset

Browser

No response

OS

No response

andrewhodel commented 1 month ago

This is confusion with the 2nd resume button placed by the browser near the address bar and the VR fullscreen running in the background with one button saying resume and one button saying enter.

There should be a standard word of all VR buttons and Oculus used resume meaning there should be a 3rd state of this button.

mrxz commented 1 month ago

I don't see the behaviour you describe. Before the session starts the button reads "Start XR" (or "Enter VR" for VRButton) and once the session has started shows "Stop XR" (or "Exit VR"). These are the only two states that are relevant for the button.

The Meta Quest Browser does show a "Resume" and "Quit" button near the address bar when showing the webpage while the immersive session is ongoing. At that point however the XRButton shows "Stop XR" which aligns with the 'Quit' action.

Before/after immersive session During immersive session
image image

What would the third state be?

Also, it's not possible to programmatically do what the 'Resume' button does AFAIK. Not to mention that it wouldn't make sense on PCVR or handheld AR.

andrewhodel commented 1 month ago

@mrxz

I don't see the behaviour you describe. Before the session starts the button reads "Start XR" (or "Enter VR" for VRButton) and once the session has started shows "Stop XR" (or "Exit VR"). These are the only two states that are relevant for the button.

The Meta Quest Browser does show a "Resume" and "Quit" button near the address bar when showing the webpage while the immersive session is ongoing. At that point however the XRButton shows "Stop XR" which aligns with the 'Quit' action.

Before/after immersive session During immersive session image image What would the third state be?

Also, it's not possible to programmatically do what the 'Resume' button does AFAIK. Not to mention that it wouldn't make sense on PCVR or handheld AR.

Resume is the third state and it is in your 2nd screenshot. It is a third state because your browser shows 3 buttons (Enter, Resume, and Quit). The VRButton only shows 2 buttons (Enter VR, Exit VR).

mrxz commented 1 month ago

@andrewhodel

Resume is the third state and it is in your 2nd screenshot. It is a third state because your browser shows 3 buttons (Enter, Resume, and Quit). The VRButton only shows 2 buttons (Enter VR, Exit VR).

Ah, but 'resume' isn't a state, it's an action. The button only cares about the two states of there being an immersive session or not. It already shows the relevant action to transition between these two states.

In any case, it's not possible to implement this "resume" action. And, like I mentioned, won't even make sense for PCVR or handheld AR. Even if it would be possible, I'm not sure it should be included in the VR/XRButton.

andrewhodel commented 1 month ago

@mrxz a button's state is the text it displays that describe the action it performs.

@Mugen87 this should not be closed.

andrewhodel commented 1 month ago

@mrxz the enter action is described as resume when there is an existing immersive session.

The button should say resume as the browser button does when there is an existing immersive session and the action that it invokes when clicked is the same as the enter action.

andrewhodel commented 1 month ago

@mrxz @Mugen87 why would you want the VRButton to have different wording than the Browser VR buttons?

mrxz commented 1 month ago

The button should say resume as the browser button does when there is an existing immersive session and the action that it invokes when clicked is the same as the enter action.

You haven't addressed any of the concerns. The 'Resume' button does something that you can't do programmatically. If it would do the "same as the enter action" it would request a new immersive session when there is already an active session. As per the WebXR spec, this will give an error.

Feel free to verify this behaviour yourself.

why would you want the VRButton to have different wording than the Browser VR buttons?

There are many different WebXR capable user agents, so it's infeasible to try and match the wording used by each one of these. The current wording seem clear enough to me, and if users want to customize it, they can easily make their own version of the button.

If you feel strongly about this feature, you should try and get WebXR spec expanded so that implementing the resume action becomes possible. Until then, there's literally nothing that can be done on the Three.js side.

andrewhodel commented 1 month ago

@mrxz the buttons having different action names than the browser has is not normal.

andrewhodel commented 1 month ago

@mrxz @mrdoob Closing this is incorrect.

donmccurdy commented 1 month ago

Matching the wording and behavior of the Meta Quest Browser — let alone every possible WebXR-compatible browser — is neither a goal of the 200-line XRButton.js example, nor possible with the WebXR API, as @mrxz has explained above.

@andrewhodel Please be respectful of the time and energy of others: continued argument and @-pings in a closed thread are unhelpful. I would recommend that you create a button customized to your wording needs, if you prefer a different behavior.