Issue with a camera not blending to the desired angle

Hi there! I’m fairly new at working with Cinemachine, but I set up a simple 3rd person (CM Free Look) and 1st person camera (CM Virtual Camera) using some tutorials but I’m having an issue:

When I transition from the 1sp person camera to the 3rd persona camera it rotates my view from where it was in 1st person to whatever the forward vector for my character is.

This sort of makes sense since I’m only rotating the body of my character in 3rd person, but when I move the 1st person camera with the mouse, my player does not rotate.

I guess I’m trying to figure out how to rotate my character in 1st person mode since it seems the process is a bit different than it is in 3rd person.

Here are my camera settings

3rd person camera (CM Free Look):

7460752--915910--3rd person cam.png

1st person camera (CM Virtual Camera):

7460752--915913--1st person cam.png

And here is the code I’m using to rotate my character in 3rd person mode:

float horizontalInput = Input.GetAxisRaw("Horizontal");
        float verticalInput = Input.GetAxisRaw("Vertical");
        direction.x = horizontalInput;
        direction.z = verticalInput;
        direction = direction.normalized;  


Vector3 moveDir = Vector3.zero;

        if (thirdPersonCamMode && direction.magnitude >= 0.1f)
        {
            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + cameraTransform.eulerAngles.y;
            float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
        }
        else
        {          
            moveDir = cameraTransform.right * horizontalInput + cameraTransform.forward * verticalInput;
        }

EDIT: If anything isn’t clear or more info is needed let me know!

If you are rotating the character to control the camera, then I suggest you to use 3rdPersonFollow body component. You can replace both of your vcams with 3rdPersonFollow (first person is a simple thirdperson, where the distance and offset are 0). On how to setup the 3rdPersonFollow body component, see our example scene: AimingRig; or this video:
https://www.youtube.com/watch?v=537B1kJp9YQ
.

If anything is not clear please let me know. If I misunderstood something please show a clip of your game, showing game view and scene view please. :slight_smile:

Thanks for the reply and for the video! I was able to follow it and I also ended up changing to the new input system so that’s a double win!

The cameras are working as I wanted now, using two CinemachineVirtualCameras, one for third person, and one for first person, as you suggested.

I’m curious though, was using the FreeLook camera for 3rd person not a good idea? I did enjoy some aspects of it, like the top middle and bottom orbits. Are CinemachineVirtualCameras more of the standard for characters?

Plain CM vcams are simpler and more performant than FreeLooks, so we tend to prefer them. You can simulate the 3-orbit effect by adding a simple script to the vcam to modify camera distance as a function of vertical angle. There is an example script that does this in the AimingRig sample scene. It’s disabled by default, but if you enable it you can see it in action.

7470479--917831--upload_2021-9-3_9-47-9.png