-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cursor should not trigger mouseenter when in VR #5411
Comments
Not sure that's a very common use case or even makes sense in immersive mode (no 2D screen available)
Looks reasonable. If people wanna use mouse in VR we can try to accommodate later. |
One use case I already have is for "VR + mouse" (which would be broken by the naive fix) is testing VR applications on desktop. These days we also have Meta's WebXR emulator chrome extension, but I personally still prefer manipulating the controllers directly in full-screen mode, over manipulating them in a separate window. |
How do you manipulate the controllers in fullscreen? In VR mode you mean? |
Sorry I could have explained more clearly. If you open this example on desktop (with no VR headset attached), and enter VR (which switches to full screen, as there is no headset) then you can use the mouse (and keys) to manipulate the controllers. This relies on the fact that even though A-Frame thinks we are in "VR" mode, we are actually just in full-screen on desktop, so the mouse is still available, and cursor events still fire. |
I would say We should probably revisit the enter immersive mode flow. Some legacy there. Starting with probably the method |
Fullscreen and |
It may be a remnant of cardboard that's been left in by chance, but it's enabled some really handing debugging flows. E.g. if I have an entity that changes it's appearance based on Personally I'd be disappointed to lose that capability. |
I think the nomenclature and language used makes little sense now. We should clean it out. There's the emulator and other alternatives that are better and don't add maintenance costs and make the API less clear or ambiguous. I'm sure there's a way to still mimic your workflow without it. We can add add a new state The emulator can also be improved. It could for example get events from the main viewport to move the controllers |
To make sure I understood correctly. You wanna keep cursor events while in fullscreen, state named now as |
Yes, that's a clear summary of what I'd like to keep. But on further reflection, I don't think that should be a priority if it's preventing you from getting to a clean consistent interface for A-Frame. Focus on getting the A-Frame interfaces right, and I'm sure I can monkey patch or mock things to make SImilarly for the desktop-based No need to pollute A-Frame core with any of this. |
Opened this meta-quest/immersive-web-emulator#54 Mouse / keyboard control of headset and controllers is clearly useful. |
Quick solution for this:
Good? |
I tried to reproduce the issues but couldn't:
I'm going to close tis for now but can reopen if there are steps to reproduce. Thanks |
Description:
When building an experience that can operate in desktop or VR mode, it's common to build desktop interactions using a
cursor
, but then use a different interaction system in VR (controller-based or hand-tracking).In VR mode, we don't expect the
cursor
to fire a "mouseenter" event, but sometimes it does.The reason is that the raycaster associated with the cursor remains in the scene on entering VR, pointing in whatever directon the last mouse pointer position was detected prior to entering VR.
If this ray intersects an object, the raycaster will fire a
raycaster-intersection
event, which will lead tocursor
emitting amousenter
event hereThis can trigger unexpected mouse hover effects to appear in applications that haven't anticipated for the possibility of receiving a mouseenter event in VR mode.
I'm not entirely sure how to fix this. First idea was to check for the combination of
rayOrigin: mouse
& vr mode, insetInteraction()
and do an early returnHowever there may be some cases where a mouse is a valid input mechanism in VR mode. E.g. on desktop if you enter full screen, you are "in vr" (
this.el.sceneEl.is('vr-mode')
returnstrue
) and yet mouse remains a valid input mechanism.I don't think there's a simple query we can do to determine whether we are on a platform where mouse input is valid or not. In the absence of such a query a fix might be:
this.mouseAvailable
tofalse
this.mouseAvailable
totrue
this.mouseAvailable
to determine whether ot not to so an early return on detection of a raycaster intersection.I'll draft a PR based on this concept, as a basis for further discussion.
The text was updated successfully, but these errors were encountered: