cancel
Showing results for 
Search instead for 
Did you mean: 

Positional Tracking Stuttering when Entering/Exiting VR

sayangel
Explorer
We recently upgraded our project to Unity 5.6.4p2 from 5.6.1f1. We're noticing now when we toggle VRSettings.enabled from false to true the positional tracking gets really jumpy. Everything else in the scene is running at frame rate. Hands rendering from the avatar sdk, scene elements, etc. are all fine. But the tracking jumps around a lot at like 5 FPS.

Tried in an empty scene as well and we can reproduce.

We're not getting any errors so not sure what the source of this is. We've tried with Utils 1.24 and 1.26 and both behave the same way.
6 REPLIES 6

sayangel
Explorer
Update: we've actually narrowed it down to it not being unity but being a bug introduced by the Oculus Utils. We were previously on Unity utils 1.13 and 1.24 introduces the bug when toggling VR on/off.

sayangel
Explorer
Looks like the source of the bug is the OVRPlugin.dll. If we revert back to OVRPlugin v 1.14 everything works fine, but 1.24 and up has this bug. You can see the Rift tracking is working just fine, but something interfacing with Unity is really choppy.


wj612apqptrc.gif

sayangel
Explorer
hi @imperativity any updates?

neelb-oculus
Explorer
Hey @sayangel, I'm an engineer at Oculus and I'm looking into this. Can you send a zip of a Unity project with the bug, so I can repro it and look into fixing it on my end? I tried repro-ing it by adding the following lines at the beginning of Start() in a script:

UnityEngine.VR.VRSettings.enabled = false;
UnityEngine.VR.VRSettings.enabled = true;

This worked fine for me on OVRPlugin 1.24.2 and Unity v5.6.4p2. A zip file would be great, and let me know if the usage above mirrors the code that triggered the bug on your end.

hyperion337
Explorer
Had to look into this again as we were upgrading to Unity 2017.4 and we managed to find a fix.


There was one problem with this however: the proximity sensor does not work after `XRSettings.LoadDeviceByName("");` but we figured out a hack that seems to work:

Modify SwitchTo2D to:

```
        XRSettings.LoadDeviceByName("");
        yield return null;
        XRSettings.enabled = false;
        yield return null;
        XRSettings.LoadDeviceByName("Oculus");
        yield return null;
```

Also don't forget to add "None" as an option in the XR SDK list in Player Settings.



hyperion337
Explorer
If you're still the right engineer to look into this @theevader, try to toggle VRSettings.enabled in an update loop, not the Start method. Our app requires users to take on and off the headset throughout the experience, and when they take it off we need to disable VR.