// UpdatePrediction void UpdatePrediction() { // Turn prediction on/off if(Input.GetKeyDown (KeyCode.P)) { if( CameraController.PredictionOn == false) CameraController.PredictionOn = true; else CameraController.PredictionOn = false; } // Update prediction value (only if prediction is on) if(CameraController.PredictionOn == true) { float pt = OVRDevice.GetPredictionTime(0); if(Input.GetKeyDown (KeyCode.Comma)) pt -= PredictionIncrement; else if(Input.GetKeyDown (KeyCode.Period)) pt += PredictionIncrement; OVRDevice.SetPredictionTime(0, pt); // re-get the prediction time to make sure it took pt = OVRDevice.GetPredictionTime(0) * 1000.0f; if(ShowVRVars == true)// limit gc strPrediction = System.String.Format ("Pred (ms): {0:F3}", pt); } else { strPrediction = "Pred: OFF"; } }
/// <summary> /// Stores the snapshot. /// </summary> /// <returns><c>true</c>, if snapshot was stored, <c>false</c> otherwise.</returns> /// <param name="snapshotName">Snapshot name.</param> bool StoreSnapshot(string snapshotName) { float f = 0; PresetManager.SetCurrentPreset(snapshotName); if (CameraController != null) { CameraController.GetIPD(ref f); PresetManager.SetPropertyFloat("IPD", ref f); f = OVRDevice.GetPredictionTime(); PresetManager.SetPropertyFloat("PREDICTION", ref f); CameraController.GetVerticalFOV(ref f); PresetManager.SetPropertyFloat("FOV", ref f); Vector3 neckPosition = Vector3.zero; CameraController.GetNeckPosition(ref neckPosition); PresetManager.SetPropertyFloat("HEIGHT", ref neckPosition.y); } if (PlayerController != null) { PlayerController.GetMoveScaleMultiplier(ref f); PresetManager.SetPropertyFloat("SPEEDMULT", ref f); PlayerController.GetRotationScaleMultiplier(ref f); PresetManager.SetPropertyFloat("ROTMULT", ref f); } return(true); }
// StoreSnapshot bool StoreSnapshot(string snapshotName) { float f = 0; PresetManager.SetCurrentPreset(snapshotName); if (CameraController != null) { CameraController.GetIPD(ref f); PresetManager.SetPropertyFloat("IPD", ref f); f = OVRDevice.GetPredictionTime(0); PresetManager.SetPropertyFloat("PREDICTION", ref f); CameraController.GetVerticalFOV(ref f); PresetManager.SetPropertyFloat("FOV", ref f); Vector3 neckPosition = Vector3.zero; CameraController.GetNeckPosition(ref neckPosition); PresetManager.SetPropertyFloat("HEIGHT", ref neckPosition.y); float Dk0 = 0.0f; float Dk1 = 0.0f; float Dk2 = 0.0f; float Dk3 = 0.0f; CameraController.GetDistortionCoefs(ref Dk0, ref Dk1, ref Dk2, ref Dk3); PresetManager.SetPropertyFloat("DISTORTIONK0", ref Dk0); PresetManager.SetPropertyFloat("DISTORTIONK1", ref Dk1); PresetManager.SetPropertyFloat("DISTORTIONK2", ref Dk2); PresetManager.SetPropertyFloat("DISTORTIONK3", ref Dk3); } if (PlayerController != null) { PlayerController.GetMoveScaleMultiplier(ref f); PresetManager.SetPropertyFloat("SPEEDMULT", ref f); PlayerController.GetRotationScaleMultiplier(ref f); PresetManager.SetPropertyFloat("ROTMULT", ref f); } return(true); }