示例#1
0
    /// <summary>
    /// Inits the camera controller variables.
    /// Made public so that it can be called by classes that require information about the
    /// camera to be present when initing variables in 'Start'
    /// </summary>
    public void InitCameraControllerVariables()
    {
        // Get the IPD value (distance between eyes in meters)
        OVRDevice.GetIPD(ref ipd);

        // Using the calculated FOV, based on distortion parameters, yeilds the best results.
        // However, public functions will allow to override the FOV if desired
        VerticalFOV = CameraMain.GetComponent <OVRCamera>().GetIdealVFOV();
        // Get aspect ratio as well
        AspectRatio = CameraMain.GetComponent <OVRCamera>().CalculateAspectRatio();

        // Get our initial world orientation of the cameras from the scene (we can grab it from
        // the set FollowOrientation object or this OVRCameraController gameObject)
        if (FollowOrientation != null)
        {
            OrientationOffset = FollowOrientation.rotation;
        }
        else
        {
            OrientationOffset = transform.rotation;
        }
    }