Hubs-Foundation / hubs

Duck-themed multi-user virtual spaces in WebVR. Built with A-Frame.
https://hubsfoundation.org
Mozilla Public License 2.0
2.13k stars 1.42k forks source link

BG - Need Hubs's cursor location #6426

Open j-conrad opened 9 months ago

j-conrad commented 9 months ago

Is your feature request related to a problem? Please describe. It would be useful to be able to reference Hubs's cursor position. This would allow all kinds of interactions since the cursor has a vec3 world position that could be compared to the position of other entities.

Slightly more difficult, but very useful, would be a way to specify screen space position (as X & Y float values). (I recognize the varying size of browser windows makes this trickier, but I suppose referencing those sizes as percentages may be necessary.) Perhaps the X & Y values could go from 0-1...

Describe the solution you'd like A node that lets me reference Hubs's cursor position. World and Screen Space as options, ideally.

Describe alternatives you've considered Not sure there is any alternative.

Additional context There may be additional outputs that could be helpful for things like "distance from user" that could help avoid having to do them all via behavior graph every time they're needed.

Unity has similar events, although these are more related to input events and UI (which we also need) so I'm not sure where these nodes belong exactly:

mousePosition: The mousePosition property returns the mouse position within the panel, also known as the screen coordinate system. 
localMousePosition: The localMousePosition property returns the coordinates relative to the target visual element.
mouseDelta: The difference between the pointer’s position during the previous mouse event and its position during the current mouse event.