Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Positional Tracking Stuttering when Entering/Exiting VR

sayangelsayangel Posts: 20
Brain Burst
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.
Tagged:

Comments

  • sayangelsayangel Posts: 20
    Brain Burst
    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.
  • sayangelsayangel Posts: 20
    Brain Burst
    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.


  • sayangelsayangel Posts: 20
    Brain Burst
    hi @imperativity any updates?
  • nbedekarnbedekar Posts: 3 Oculus Staff
    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.
  • haydenjamesleehaydenjameslee Posts: 47
    Brain Burst
    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.



  • haydenjamesleehaydenjameslee Posts: 47
    Brain Burst
    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.

Sign In or Register to comment.