Exemple #1
0
        private void Update()
        {
            //  m_CameraRefocus.GetFocusPoint();
            Vector3 newCameraPosition;

            if (firstPersonController.GetPhysicsController().velocity.magnitude > 0 && firstPersonController.GetPhysicsController().isGrounded)
            {
                Camera.transform.localPosition = motionBob.DoHeadBob(firstPersonController.GetPhysicsController().velocity.magnitude *(firstPersonController.IsRunning() ? 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 && firstPersonController.GetPhysicsController().isGrounded)
            {
                StartCoroutine(jumpAndLandingBob.DoBobCycle());
            }

            m_PreviouslyGrounded = firstPersonController.GetPhysicsController().isGrounded;
            //  m_CameraRefocus.SetFocusPoint();
        }