- Home /
Disable Positional Tracking of Oculus CV1 in Unity 5.4.1
In Unity 5.3.3 through 5.4.0 we used the OVRPlugin to VR support and parameters like rotational and positional tracking.
Now that the VR Camera it built into Unity, the OVRPlugin is no longer required, but the ability to enable/disable rotational and positional tracking is not available in Unity.
How can I disable positional tracking of the VR Camera in Unity 5.4.1?
I am trying to play a stereoscopic 360 video in Unity, so I have no need for the positional tracking.
Answer by EyePD · Oct 21, 2016 at 06:24 PM
Unity 5.6 introduced a disablePositionalTracking static into UnityEngine.VR.InputTracking.
If you need to do it in older versions, in this thread it's suggested that you can:
Make a script on the parent object of the camera that moves the transform position to counteract the position on the camera transform.
I tried it out and it seems to work fine:
public class DisablePositionalTracking : MonoBehaviour {
public GameObject cameraGameObject;
// Disable positional tracking by applying an opposite offset from the camera that's being
// moved by the HMD. This script should be applied on an empty parent object of the camera.
void Update ()
{
if (cameraGameObject != null)
{
Vector3 offset = new Vector3(
-cameraGameObject.transform.localPosition.x,
-cameraGameObject.transform.localPosition.y,
-cameraGameObject.transform.localPosition.z);
transform.localPosition = offset;
}
}
}
Thanks for the suggestion. I tried implementing this with Unity 5.4.2, which apparently updates the Oculus plugin to 1.8. I'm getting a noticeable drop in performance.
With the default positioning enabled on the native Unity VR camera, I'm getting 90FPS.
With the DisablePositionalTracking script, I'm getting frequent (every 3-4 frames) spikes down to 35FPS.
With the OVRPlugin and Position Tracking disabled, I'm getting 90FPS.
Hope that Unity builds a native editor solution soon.
Answer by NFB_VM · Oct 21, 2016 at 07:13 PM
Thanks for the reply. I ended up using the OVRPlugin, but this is obviously not ideal for cross platform. I may try you suggested solution, but it seems like there's a lot of unnecessary processing going on to counteract something that should be disable-able.
I think the performance impact here should be negligible; it's really just one extra transform and copying and negating the camera's transform should be pretty low impact. I agree completely though; this should just be a checkbox. Please consider voting for bug 788105.