Zoom with keys

I implemented my zoom with the Z and X keys instead since I’m on a laptop. Sharing the code here. Does’t need a Lerp, since the ‘smoothing’ is done by the ‘zoomAmount’ value.

float zoomAmount = 0.31f;

    if (Input.GetKey(KeyCode.Z))

    {

    followOffset.y -= zoomAmount;

    }

    if (Input.GetKey(KeyCode.X))

    {

    followOffset.y += zoomAmount;

    }

    followOffset.y = Mathf.Clamp(followOffset.y, MIN_FOLLOW_Y_OFFSET, MAX_FOLLOW_Y_OFFSET);

    cinemachineTransposer.m_FollowOffset = followOffset;

Privacy & Terms