Skip to content
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

Configurable VR Simulator Controls #279

Open
bferguson3 opened this issue Jul 29, 2020 · 3 comments
Open

Configurable VR Simulator Controls #279

bferguson3 opened this issue Jul 29, 2020 · 3 comments

Comments

@bferguson3
Copy link
Contributor

bferguson3 commented Jul 29, 2020

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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Owner

bjornbytes commented Sep 25, 2020

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:

  • Add "Space" objects similar to what openxr/webxr have that let you have arbitrary reference frames. Maybe you can use keyboard/mouse input in Lua to define the origin for a Space and then you have some way of telling the headset module to apply that to its views.
  • Something like lovr.headset.updateSimulatedTransform could take inputs and return a simulated head transform. This could be used with lovr.graphics.setViewPose to simulate a camera, or be combined with the Space idea above so that lovr.headset.getPose still works.

Tricky, still kinda fuzzy, but getting closer!

@bjornbytes bjornbytes changed the title Hard-coded keyboard/mouse input Non-Opaque VR Simulator Controls Sep 25, 2020
@bjornbytes bjornbytes changed the title Non-Opaque VR Simulator Controls Configurable VR Simulator Controls Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants