Quick question: How do I update the Body Transposer Follow offset in code

Basically, I want to update the y and z distance when the mouse wheel is moved for a zoom feature.

CinemachineVirtualCamera vcam;
vcam.GetCinemachineComponent().m_FollowOffset = bla;

oh right… thanks for unlocking my brain… :slight_smile:

actually, what is the correct way to zoom in and out on a transposer with a follow offset ?

Changing y and z positions of the FollowOffset raises and lowers the camera, which isn’t what I’m looking for.

What I really want to do is project the camera out a bit from the target and find a way to translate that to a correct FollowOffset.

In other words, I need to convert a new camera position (which is easy to calculate) to a follow offset; a world position to a relative position.

Would a zoom slider not be a cool feature?

Exactly. Note that the interpretation of the follow offset is dependent on the Transposer’s Binding Mode. Most are in target-local coords, but world-spoace is world coords, and SimpleFollow is in Camera coords.

ok I have it working now.

Vector3 newPos = PanCamera.transform.position;
newPos += -PanCamera.transform.forward * mouseWheel* Time.deltaTime * zoomSpeed;
Vector3 newOffset = followObject.transform.InverseTransformPoint(newPos);
PanCamera.GetCinemachineComponent().m_FollowOffset = newOffset;

My only issue now is that it doesn’t have a dampening factor that makes other camera movements seem so smooth.

That’s correct. Damping does not apply to offset changes. This allows cameras to be responsive to user input irrespective of their damping settings. You’ll have to implement the zoom damping yourself.