How can I access the height and radius variables through code?

Hello everyone,

I have a quick question on how I can change the height and radius variables on my CinemachineFreeLook component through a script.

Does anyone know how to do this? I will need to change these values based on certain events that will affect the player’s size, and I’d like to scale the camera’s distance and height accordingly. I just need to know how I can change those variables for all three rigs through code instead of manually.

You can access it through Freelook’s m_Orbit property (m_Height, m_Radius).

var freelook = GetComponent<CinemachineFreeLook>();
freelook.m_Orbits[0].m_Height = h0; // TopRig
freelook.m_Orbits[1].m_Height = h1; // MiddleRig
freelook.m_Orbits[2].m_Height = h2; // BottomRig
5 Likes

thank you so much for your help!!

2 Likes