bjornbytes / lovr

Lua Virtual Reality Framework
https://lovr.org
MIT License
1.97k stars 137 forks source link

Configurable VR Simulator Controls #279

Open bferguson3 opened 4 years ago

bferguson3 commented 4 years ago

The keys WASDQE, Arrow keys, mouse movement and mouse click are presently bound hard-coded in GL input to what APPEARS to be a headset offset value, but I can't tell for sure.

Input should never be hard-coded. These also don't generate keyboard callbacks, so they can't be overridden by lovr.keyboard.

Suggested: Merge lovr.keyboard as a base library and implement these controls as lovr-layer callbacks instead

Repro steps:

  1. Utilize a specular light source to illuminate a model (passing camera/view position to the shader)
  2. Set mirror to: lovr.mirror() lovr.graphics.clear() lovr.draw() end
  3. Start app and use wasdqe/arrows and observe light source moves despite there being "no input code"

Further testing: Tying wasd or arrows to a transform offset creates all sorts of lighting glitches when changing position and rotation of the viewpoint.

bjornbytes commented 4 years ago

What would the "lovr-layer callbacks" be? I also want the fake headset controls to be moved up into Lua where they can be more customizable, but I haven't been able to come up with a good way to do it

bferguson3 commented 4 years ago

Imo lovr-keyboard should be integrated into the base code as a built-in library, and the headset controls should simply be remapped to use them, i.e. lovr.keyboard.isDown("w") { headsetOffset.z [...]

This way users can override them if they wish but they are still fully functional and hidden by default.

bjornbytes commented 4 years ago

Progress on this has been made: There are lovr.keypressed and lovr.keyreleased callbacks. Moving the desktop headset driver controls into Lua is still a bit tricky though. Ideas I'm going to explore are:

Tricky, still kinda fuzzy, but getting closer!