예제 #1
0
        private void RotateView()
        {
                        #if !MOBILE_INPUT
            Vector2 mouseInput = _mouseLook.Clamped(_yRotation, transform.localEulerAngles.y);

            _camera.transform.localEulerAngles = new Vector3(-mouseInput.y, _camera.transform.localEulerAngles.y,
                                                             _camera.transform.localEulerAngles.z);
            transform.localEulerAngles = new Vector3(0, mouseInput.x, 0);
                        #else
            Vector2 mouseInput = new Vector2(CrossPlatformInputManager.GetAxisRaw("HorizontalLook"),
                                             CrossPlatformInputManager.GetAxisRaw("VerticalLook"));

            float camX = _camera.transform.localEulerAngles.x;

            if ((camX > 280 && camX <= 360) ||
                (camX >= 0 && camX < 80) ||
                (camX >= 80 && camX < 180 && mouseInput.y > 0) ||
                (camX > 180 && camX <= 280 && mouseInput.y < 0))
            {
                _camera.transform.localEulerAngles += new Vector3(-mouseInput.y * lookSpeed * .7f, _camera.transform.localEulerAngles.y,
                                                                  _camera.transform.localEulerAngles.z);
            }

            transform.localEulerAngles += new Vector3(0, mouseInput.x * lookSpeed, 0);
                        #endif
            // handle the roation round the x axis on the camera

            _yRotation = mouseInput.y;
            _cameraRefocus.GetFocusPoint();
        }
예제 #2
0
        private void LateUpdate()
        {
            m_CameraRefocus.GetFocusPoint();
            Vector3 newCameraPosition;

            if (rigidbodyFirstPersonController.Velocity.magnitude > 0 && rigidbodyFirstPersonController.grounded)
            {
                Camera.transform.localPosition = motionBob.DoHeadBob(rigidbodyFirstPersonController.Velocity.magnitude * (rigidbodyFirstPersonController.Running ? RunningStrideLengthen : 1f));
                newCameraPosition   = Camera.transform.localPosition;
                newCameraPosition.y = Camera.transform.localPosition.y - jumpAndLandingBob.Offset();
            }
            else
            {
                newCameraPosition   = Camera.transform.localPosition;
                newCameraPosition.y = m_OriginalCameraPosition.y - jumpAndLandingBob.Offset();
            }
            Camera.transform.localPosition = newCameraPosition;

            if (!m_PreviouslyGrounded && rigidbodyFirstPersonController.grounded)
            {
                StartCoroutine(jumpAndLandingBob.DoBobCycle());
            }

            m_PreviouslyGrounded = rigidbodyFirstPersonController.grounded;
            m_CameraRefocus.SetFocusPoint();
        }
        private void RotateView()
        {
            Vector2 mouseInput = _mouseLook.Clamped(_yRotation, transform.localEulerAngles.y);

            // handle the roation round the x axis on the camera
            _camera.transform.localEulerAngles = new Vector3(-mouseInput.y, _camera.transform.localEulerAngles.y,
                                                             _camera.transform.localEulerAngles.z);
            _yRotation = mouseInput.y;
            transform.localEulerAngles = new Vector3(0, mouseInput.x, 0);
            _cameraRefocus.GetFocusPoint();
        }
 private void RotateView()
 {
     m_MouseLook.LookRotation(transform, m_Camera.transform);
     m_CameraRefocus.GetFocusPoint();
 }