ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.1k stars 1.28k forks source link

Problem to override Oculus quest2 controller input. #1589

Open inlet511 opened 3 years ago

inlet511 commented 3 years ago

Purpose: We want to control the movement by our own device, and are trying to make our device compatible with all kinds of VR headsets. Things goes well on HTC Vive, but problems occur when working with Oculus Quest2.

Steps:

  1. Create StreamVR Custom Driver.
  2. Set the loadPriority to -100. loadPriority of Oculus device is 0 by default, so Oculus device should be loaded early than custom driver.
  3. Get Oculus quest2 device in Custom Driver, and add an input component(CreateScalarComponent) to Input Device(/input/joystick/x).
  4. Call UpdateScalarComponent in RunFrame function of IServerTrackedDeviceProvider , in order to update Oculus quest2 controller input(/input/joystick/x).

Expectation: It's expected that we can now override Oculus controller input in my custom driver.

Problem: We do override the input of Oculus quest2 Controller, however, the input result will be overrided back by Oculus quest2 controller periodically。 but this problem keeps stopping our movement periodically. Is this because Oculus starts there's own OpenVR Driver in another process?

Any Ideas? Thanks!

danwillm commented 1 year ago

The oculus driver most likely updates its inputs in another thread, meaning that it's possible it is setting inputs between when you are updating them. To get the functionality you're looking for you'd have to hook calls to vrserver from the oculus driver. Though, it's probably preferable if you were to create your own device and use that to emulate a quest 2 controller.