Is it possible to zoom with a Cinemachine FreeLock camera in Unity?

312 Views Asked by At

In a 3D game, I have a 3rd person view and the camera rotates relative to the player regardless of the player's orientation. I used a Cinemachine Freelook camera for this. But I don't know how to zoom with this camera.

enter image description here

When I raised or lowered the mouse wheel, I tried to adjust the height and radius of Freelock's rigs. But there is no data about this and I can't see what the corresponding function is.

enter image description here

1

There are 1 best solutions below

0
On
private void UpdateRadiusHeightofRigs()
    {
        for (int i = 0; i < 3; i++)
        {
            cinemachineFreeLook.m_Orbits[i].m_Radius = orbitRadii[i] * zoomDistance;
            cinemachineFreeLook.m_Orbits[i].m_Height = orbitHeight[i] * zoomDistance;
        }
    }

Maybe you've figured it out already, but this is an easy way to adjust the zoom of the cinemachine freelook camera/orbital camera.

You'll have to set the reference radii and height like this:

//starting radius & height of each orbit
//top to bottom rigs
[SerializeField] int[] orbitRadii = { 36, 72, 72 };
[SerializeField] int[] orbitHeight = { 100, 50, 0 };

Hope it helps!