예제 #1
0
    /// <summary>
    /// Updates the prediction.
    /// </summary>
    void UpdatePrediction()
    {
        // Turn prediction on/off
        if (Input.GetKeyDown(KeyCode.P))
        {
            if (CameraController.PredictionOn == false)
            {
                CameraController.PredictionOn = true;
                OVRDevice.UsePrediction(true);
            }
            else
            {
                CameraController.PredictionOn = false;
                OVRDevice.UsePrediction(false);
            }
        }

        // Update prediction value (only if prediction is on)
        if (CameraController.PredictionOn == true)
        {
            float pt = OVRDevice.GetPredictionTime();
            if (Input.GetKeyDown(KeyCode.Comma))
            {
                pt -= PredictionIncrement;
            }
            else if (Input.GetKeyDown(KeyCode.Period))
            {
                pt += PredictionIncrement;
            }

            OVRDevice.SetPredictionTime(pt);

            // re-get the prediction time to make sure it took
            pt = OVRDevice.GetPredictionTime() * 1000.0f;

            if (ShowVRVars == true)           // limit gc
            {
                strPrediction = System.String.Format("Pred (ms): {0:F3}", pt);
            }
        }
        else
        {
            strPrediction = "Pred: OFF";
        }
    }