SetOrientationOffset() public method

public SetOrientationOffset ( Quaternion orientationOffset ) : void
orientationOffset Quaternion
return void
コード例 #1
0
 /// <summary>
 /// Sets the cameras.
 /// </summary>
 public void SetCameras()
 {
     if (CameraController != null)
     {
         // Make sure to set the initial direction of the camera
         // to match the game player direction
         CameraController.SetOrientationOffset(OrientationOffset);
         CameraController.SetYRotation(YRotation);
     }
 }
コード例 #2
0
    void Update()
    {
#if (UNITY_EDITOR)
        if (AllowMouseLook)
        {
            if (LockMouse && CaptureMouseCursor)
            {
                Screen.lockCursor = true;
            }
            else
            {
                Screen.lockCursor = false;
            }

            if (CaptureMouseCursor)
            {
                OVRCameraController cameraController = GetComponent <OVRCameraController>();

                float MousePitchDelta = Input.GetAxis("Mouse Y") * MouseSensitivityPitch;
                float MouseYawDelta   = Input.GetAxis("Mouse X") * MouseSensitivityYaw * -1.0f;
                if (InvertPitch)
                {
                    MouseYawDelta = -MouseYawDelta;
                }

                MouseAngles.x += MousePitchDelta;
                MouseAngles.y += MouseYawDelta;
                if (MousePitchDelta > 0.0f)
                {
                    if (MouseAngles.x > 89.5f)
                    {
                        MouseAngles.x = 89.5f;
                    }
                }
                else if (MousePitchDelta < 0.0f)
                {
                    if (MouseAngles.x < -89.5f)
                    {
                        MouseAngles.x = -89.5f;
                    }
                }
                MouseAngles.y = Mathf.Clamp(MouseAngles.y, -360.0f, 360.0f);

                Quaternion q = Quaternion.Euler(MouseAngles.x, MouseAngles.y, 0.0f);

                cameraController.SetOrientationOffset(q);
            }
        }
#endif
    }