protected virtual void CameraInput()
        {
            if (tpCamera == null)
            {
                return;
            }
            var Y = Input.GetAxis(rotateCameraYInput);
            var X = Input.GetAxis(rotateCameraXInput);

            tpCamera.RotateCamera(X, Y);

            // tranform Character direction from camera if not KeepDirection
            if (!keepDirection)
            {
                cc.UpdateTargetDirection(tpCamera != null ? tpCamera.transform : null);
            }
            // rotate the character with the camera while strafing
            RotateWithCamera(tpCamera != null ? tpCamera.transform : null);
        }
Example #2
0
        protected virtual void CameraInput()
        {
            if (tpCamera == null)
            {
                return;
            }
            var Y = Input.GetAxis(rotateCameraYInput);
            var X = Input.GetAxis(rotateCameraXInput);

            tpCamera.RotateCamera(X, Y);


            if (!keepDirection)
            {
                cc.UpdateTargetDirection(tpCamera != null ? tpCamera.transform : null);
            }

            RotateWithCamera(tpCamera != null ? tpCamera.transform : null);
        }
        protected virtual void CameraInput()
        {
            if (tpCamera == null)
            {
                return;
            }
            var Y = input.MouseY;
            var X = input.MouseX;

            tpCamera.RotateCamera(X, Y);

            // tranform Character direction from camera if not KeepDirection
            // UpdateTargetDirection is the key method here
            // Everything else lerps the camera smoothly when strafe is toggled
            // or rotates you with the camera when it should be fixed.
            if (!keepDirection)
            {
                cc.UpdateTargetDirection(tpCamera != null ? tpCamera.transform : null);
            }
            // rotate the character with the camera while strafing
            RotateWithCamera(tpCamera != null ? tpCamera.transform : null);
        }