I'm trying to edit the default oculus camera scripts to stop responding to the tracking sensor for a period of time and then resume normal movement from the place where the camera pointed at the time it stopped following the tracking sensor.
I was able to stop the camera from responding to the tracking sensor, but now when it resumes working it "snaps" to the position where the camera would be if the sensor was not deactivated. I, however, want it to just "seamlessly" resume tracking. So I guess I also have to stop some variable from updating during that time.
Here is my code so far, it's situated in the OVRCamera script in the function SetCameraOrientation:
if (Time.realtimeSinceStartup >= 11f && Time.realtimeSinceStartup <= 17f)
{
camera.transform.rotation = lastRotation;
}
else
{
camera.transform.rotation = q;
lastRotation = q;
}
And this is the variable declaration for my new variable:
private Quaternion lastRotation = new Quaternion();
I'd appreciate it if someone could help me out.
Thanks.