How can I offset a CinemachineFreeLook at runtime?

Hi, I am using the CinemachineFreeLook for a third person camera. When the player does not have a ranged weapon equipped I want the camera to focus on the player-character. When they do have a ranged weapon equipped I want to offset the camera to focus to the right of the character’s shoulder to so they can aim. It seems like maybe changing each Orbit/Rig Aim’s screen x is the right way to do this? But how do I do this for each rig at runtime?

FreeLook isn’t the best choice for an over-the-shoulder aiming camera. You will have trouble getting it to aim precisely.
Have a look at these Cinemachine sample scenes for better alternatives:

  • AimingRig
  • 3rdPersonWithAimMode
1 Like

Alright, thanks for the response! I am now using a regular CinemachineVirtualCamera with 3rd Person Follow and Aiming extension.

I would like to be able to change the offset when the player equips a ranged weapon. Should I do this by accessing the offset in C# script (If so, how do I do that?) Or should I have a different VirtualCamera for each different offset setting and then switch between them?

1 Like

Either way will work. You can have a different vcam for each, or you can just change the offsets dynamically.

To change the offsets you can do: vcam.GetCinemachineComponent<Cinemachine3rdPersonFollow>().ShoulderOffset = bla etc.

1 Like