SimulaVR / Simula

Linux VR Desktop
MIT License
2.91k stars 87 forks source link

Making Simula usable without a Vive controller #95

Closed georgewsinger closed 4 years ago

georgewsinger commented 4 years ago

Using the Vive controller for inputs is inefficient. @NerveCoordinator feedback:

a google search requires

  • pick up controller, point at firefox
  • click in the tiny little search bar
  • set down controller, type
  • pick up controller again

… extremely inefficient,

Proposal. Here is a proposed way that we can integrate traditional mouse & keyboard usage into Simula. Let MOD be a modifier key (e.g. Ctrl, Alt, etc). Here are some controls we could add to Simula:

  1. Place a mouse pointer on the window being stared at. Stare at a window and press and release MOD; the window will be activated and have a pointer placed at the location of user's gaze. Once placed, the pointer can be used as usual with a mouse (movement, left-click, right-click, drag and drop, etc), but will be movement-bounded for now by the window's boundary.
  2. Orient a window towards the user's gaze. Stare at a window and press MOD + w.
  3. Quickly left-click on a window being stared at. Stare at a window and press MOD + l.
  4. Move a window backwards/forwards. Stare at the window and, while holding down MOD, scroll up or down on the mouse wheel.
  5. Manipulate a window around its sphere. Stare at the window and, while holding down MOD + m, orient your gaze towards where you want the window placed in the sphere surrounding your current world position.

Eventually, we could make these bindings alterable with a configuration file.

lboklin commented 4 years ago

Quick reflection: Controlling the pointer through neck movements is imprecise and will cause neck strain. Eye-tracking would be good for this though. Controlling the pointer with your mouse once a window is focused is a potential solution.

georgewsinger commented 4 years ago

@lboklin Agreed: (1) allows us to place a mouse pointer in a window, which can then be controller by the PC mouse.

georgewsinger commented 4 years ago

Mouse handling: Godot vs. wlroots. The biggest question for me right now is how to make Godot's normal mouse handling (when you e.g. move the mouse accross the Godot pancake mode) play well with our new wlroots cursor handling. Some questions:

In either case: if the user passes the mouse into Simula (the pancake window), it looks like the new behavior is going to be that Simula will "swallow the cursor" (in the sense that users won't be able to just move the mouse out of the pancake bounds like normal). Is this a problem? If so: how should users be able to get their OS cursor back?

georgewsinger commented 4 years ago

Routing godot mouse movement to wlroots. I think the best way to handle this is to keep Godot mouse handling and set Input.MouseMode to MOUSE_MODE_HIDDEN + MOUSE_MODE_CAPTURED (perhaps toggleable by some keyboard shortcut)

enum MouseMode:
MOUSE_MODE_HIDDEN = 1 — Makes the mouse cursor hidden if it is visible.
MOUSE_MODE_CAPTURED = 2 — Captures the mouse. The mouse will be hidden and unable to leave the game window, but it will still register movement and mouse button presses. On Windows and Linux, the mouse will use raw input mode, which means the reported movement will be unaffected by the OS’ mouse acceleration settings.

and to then, each frame, route all Godot mouse data to wlroots via

Vector2 get_last_mouse_speed ( ) const
Returns the mouse speed for the last time the cursor was moved, and this until the next frame where the mouse moves. This means that even if the mouse is not moving, this function will still return the value of the last motion.

int get_mouse_button_mask ( ) const
Returns mouse buttons as a bitmask. If multiple mouse buttons are pressed at the same time the bits are added together.