Unity and Cinemachine — Virtual Camera Body Options

Joshua Nielsen
4 min readMar 17, 2022

--

Discover what your virtual cameras can do with followed objects

Photo by DSD from Pexels

Let’s keep exploring Cinemachine in Unity. Last time we looked at advanced options for when a virtual camera “Looks At” a specified game object. In this article we’re going to look at advanced options for when a virtual camera “Follows” a specified object.

As a quick review of previous articles, Cinemachine virtual cameras are objects that allow us to take advantage of a wide array of effects and behaviors to apply to the main camera in Unity.

Amongst other things, virtual cameras can be set to Follow and/or Look At a specified game object/transform. When that is done, new options are opened to configure the virtual camera and how it behaves.

We’ve examined the options for Look At already, now let’s check the Body options we can access with objects that we Follow.

Initial Setup

Just like with our Aim options, we first need two things: a virtual camera and a game object to Follow. Be sure to set the virtual camera to Follow the game object.

For purposes of seeing the virtual camera truly in action, you should also animate the game object moving around a bit. After all, following something doesn’t mean a whole lot if that something doesn’t move.

With all of these things in place, we can now look in the Inspector window to see the seven options we have for the Body field.

The options for the Body field of a virtual camera.

Do nothing

Our first option is Do nothing, which… does nothing. Or does nothing automatically might be a better way to put it. You might use this option if you wished to use custom scripting for your virtual camera.

3rd Person Follow

The 3rd Person Follow option keeps the virtual camera at a constant position and distance relative to the target while matching the target’s movement and rotation.

The 3rd Person Follow options for the Body section.

Let’s focus on a couple of things here.

First, there’s the Rig section, which with proper configuring can offer us the ability to easily switch between which shoulder to look over (assuming a humanoid player model).

Second, the Obstacles section, which allows us to configure how collisions are handled between the camera and other objects. This allows us to avoid having the camera inadvertently pass into and through walls or other objects.

Framing Transposer

The Framing Transposer option moves the virtual camera in a fixed screen-space relationship to the specified target. It is primarily designed for 2d and orthographic oriented virtual cameras, but it will work in other scenarios as well.

Hard Lock To Target

With the Hard Lock To Target option, the virtual camera locks onto the target and has the same position as it. It does not, however, rotate with its target.

Orbital Transposer

The Orbital Transposer option moves the virtual camera in a variable relationship to its target. This option can also be configured to accept player input to allow the player to control the position of the virtual camera relative to the followed target.

The Orbital Transposer options for the Body section.

The Orbital Transposer option has a couple of interesting new features to pay attention to.

The first is Heading, which is the direction the target is moving or facing. The Orbital Transposer will attempt to position the virtual camera so that it points in the same direction as the heading.

The second is the X Axis options, which determine aspects of the user input and its effect over the Orbital Transposer.

Tracked Dolly

The Tracked Dolly option restricts the virtual camera to only move along a preset path. This path is represented by a Cinemachine Dolly Track object.

The Tracked Dolly options for the Body section.

The Auto Dolly mode needs to be enabled in order to automatically animate the position of the virtual camera to the position on the track that is closest to the target.

Transposer

Finally, the default Transposer option moves the virtual camera in a fixed offset to the followed target.

The Transposer options for the Body section.

Conclusion

That gives us a little taste of what options are available for virtual cameras with a specified Follow target. In the next article, we’re going to go a little deeper and examine a few of these options more closely. Until then, thanks for reading.

--

--