Unity Oculus: Controllers disappear when the HMD is unmounted and then mounted in the Windows build

1.4k views Asked by At

I develop a game of VR(Oculus Quest 2) in Unity.

In the Windows standalone build, the controller and hand tracking do not work if the HMD is unmounted and then mounted.

The detailed situation is as follows.

  • When I put on the HMD and start the game, I don't have any problems at first; it plays fine until I remove the HMD.
  • If you remove the HMD during a game, wait a moment, and then put it back on, the controller and hand tracking will not function.
  • With the HMD removed, a slight movement of the mouse on the PC will restore the controller and hand tracking.
    • At this time, the camera position becomes (0, 0, 0) on the PC screen and stops tracking the HMD position.
  • The above problem does not occur in APK builds.
  • This does not occur when I press the play button in the Unity editor and check on the actual device using Oculus Link.

Versions

  • Oculus application: 38.0
  • Oculus Quest2: 38.0
  • Unity: 2021.2.7f1
  • Oculus Integration: 38.0
  • MRTK: 2.7.3

I do not see the key to solution at all and would appreciate your listing it if it is what, or it may seem to be revealed as it is enough even for seeming to become the hint.

1

There are 1 answers

0
nikokoneko On

I was having the same problem and after a night spent on this, I found a solution. There are many bugs in Oculus Integration package. So instead, in: Project Settings > XR Plugin In Management do not use Oculus, use OpenXR instead. Caveat: If you use default XR rig, by default the controllers will not be tracked, but it's easily fixed. In Project Settings > XR Plugin In Management>OpenXR under Interaction Profiles add a Oculus Touch Controller profile.

Background: not only OpenXR solves this bug but a range other bugs that I found with Oculus package. Using Oculus, there were always problems (using PCVR via Oculus Link) of correctly detecting the headset taken on/off. OpenXR does everything perfectly and consistently. Also provides a range of ways (via OpenXRFeatures) on how to track session state (ie headset taken off/ tracking lost / regained...)... None of it available via Oculus (that work consistently, that is). Via Oculus there was not even a consistent way to detect user presence, again because the app is getting wrong inputs from Quest via Oculus. Hope this help.