A Simple Way to Disable Tracking...
I wanted to be able to lock the camera to a specific orientation during particular scenes and needed to prevent the tracker from rotating the cameras. This is the way I did it if anyone else needs to do this. Note once you do this you can then animate the Parent Controller to transform the cameras location/orientation.
1: Add a Bool to OVRCameraController
2: Add a UI Toggle in the OVRCameraControllerEditor
3: Edit the SetOrientation Call Conditions in OVRCamera
1: Add a Bool to OVRCameraController
// Do we track the sensor or just look straight forward, default true
public bool Tracking = true;
2: Add a UI Toggle in the OVRCameraControllerEditor
m_Component.Chromatic = EditorGUILayout.Toggle ("Chromatic", m_Component.Chromatic);
m_Component.Tracking = EditorGUILayout.Toggle ("Tracking", m_Component.Tracking); // HERE!
3: Edit the SetOrientation Call Conditions in OVRCamera
// OnPreCull
void OnPreCull()
{
// NOTE: Setting the camera here increases latency, but ensures
// that all Unity sub-systems that rely on camera location before
// being set to render are satisfied.
if (CameraController.CallInPreRender == false && CameraController.Tracking) // HERE...
SetCameraOrientation();
}
// OnPreRender
void OnPreRender()
{
// NOTE: Better latency performance here, but messes up water rendering and other
// systems that rely on the camera to be set before PreCull takes place.
if (CameraController.CallInPreRender == true && CameraController.Tracking) // AND HERE
SetCameraOrientation();
if(CameraController.WireMode == true)
GL.wireframe = true;
// Set new buffers and clear color and depth
if(CameraTexture != null)
{
Graphics.SetRenderTarget(CameraTexture);
GL.Clear (true, true, gameObject.camera.backgroundColor);
}
}
