Is it possible to auto-zoom or auto-move the virtual camera so the LookAt target fills the screen?

I’m experienced with Unity but a total cinemachine newbie, so I apologize in advance if this question is super-basic. I’m learning about the LookAt property, but it seems to focus on a point rather than a volume of space (e.g. bounds), so the framing isn’t always right depending on what you point it at.

Is it possible to auto-zoom or auto-move the virtual camera, so that whatever the LookAt value is fills the Composer area? For example, when choosing between characters options for an RPG, it would zoom in for a Gnome and then zoom out for a Giant automatically. Or for a spaceship game like EVE Online, it would zoom in for a fighter and then zoom out for a battleship, keeping the target framed nicely in the Composer regardless of its size.

In programming terms, I imagine you’d pass in a Bounds or a Collider, and it would adjust so that the volume of that object filled the Composer area on-screen.

This feature is available as an extension: CinemachineFollowZoom. This accepts a width parameter to do its adjustments. If this is not sufficient for your case, let us know ;).
7566505--936634--extensions.png

Some components also have a built-in zoom feature:

  • FramingTransposer component,

  • GroupComposer component.

I think it would be great if you could add CinemachineFollowDolly, where it would lock the FOV but shove the camera forward or back on its Z axis to meet the same objectives. Sometimes mucking with FOV is not the right answer.

You could do a little prep work and figure out the linear “width” that CinemachineFollowZoom needs from the object, but it would be an approximation. I suggest the length of the 3D diagonal of the Bounds.

1 Like

Noted. :slight_smile:
In the meantime, FramingTransposer and GroupComposer can do that if the Follow or LookAt target is a TargetGroup respectively.

1 Like