Blend between VCam and FreeLook position/rotation are not similar

I’m using a CinemachineStateDrivenCamera to blend between a Cinemachine VCam and Cinemachine Free Look for first person perspective and third person perspective.

The issue is these cameras are not pointing the same direction upon switching. Here is the code I am using for controlling the swapping.

public void SwitchState()
    {
        if (animStateInfo.shortNameHash == hashFirstPersonState)
        {
            animator.Play(hashThirdPersonState);
        }
        else
        {
            animator.Play(hashFirstPersonState);
        }
        animStateInfo = animator.GetCurrentAnimatorStateInfo(0);
    }

Here are screenshots of the inspector for each Cinemachine camera and the structure


And finally examples of the camera swap where they the first person perspective camera is facing a direction different from the start but the third person perspective starts in starting direction instead of facing the same direction as the first person.

You should not put your CinemachineVirtualCameras (vcams) as children of the Main Camera. Vcams control the Transform of the Main Camera. If your vcams are children of the Main Camera, then this may cause bugs, because their transforms get modified as the Main Camera moves. It is like a dog chasing its tail.

Same applies to Player. It should not be the parent of Main Camera and the vcams in most cases.

To fix these, move out your Main Camera and vcams from Player. And move out the vcams from Main Camera. Your hierarchy should look something like this:
7186012--861886--Hierarchy.png

If you have any questions or need clarification, please reach out. :slight_smile: We are happy to assist you.

I don’t understand the problem. Could you clarify please?

I’m attempting to create a system showcased in this video where you can switch between first and third person cameras.

https://www.youtube.com/watch?v=ZuyWm_xSLjY

Thank you, I will attempt this and see if I can get it working with the proper hierarchy.

The proper way to setup a system like this is to create two vcams:

  • One first person vcam (firstPersonVcam)
  • One third person vcam (thirdPersonVcam)

For an example third person camera setup using ThirdPersonFollow component, and 3rdPersonAim extension. See our AimingRig sample scene. You can download our sample scenes from the Package manager.
7186336--861931--Screen Shot 2021-05-28 at 11.28.39 AM.png

First person vcam can be setup in two ways. One is to use ThirdPersonFollow with parameters set to something like this:
7188550--862417--FirstPerson.png

Another way, is to use a Do Nothing vcam (both follow and aim behaviours set to Do Nothing). This means that the vcam’s transform is not controlled by Cinemachine. In this case, the vcam’s transform directly controls the main camera. In this case, you can put the vcam as a child of the player or the gun and then position and rotate it manually to where you’d like it to be.

Then, two switch between the two vcams, you can either enable/disable them or use the Priorities to make one active. The higher priority will be active.

Thank you so much. I was attempting one VCam and one FreeLook Camera (a lot of online guides teach how to make a third person camera with the Free Look CM)

If I could bother you for one more thing is it possible to have the camera transition based only on the horizontal positioning? If I’m looking slightly down in first person the third person camera feels a bit too high and the same vice versa (look down a little bit in third person and I’m looking all the way down in first person)

FreeLook is no longer the recommended way to set up a 3rd Person camera - especially if aiming is a priority. You’ll get better results with a 3rdPerson Follow component, as demonstrated in the AimingRig sample scene. It is also described here: