3rd Person Follow Virtual Camera Explained in Unity’s Cinemachine

Chris Hilton
6 min readJan 11, 2022

--

Objective: To understand what the 3rd Person Follow virtual camera is in Unity’s Cinemachine and how to use it.

3rd person follow camera tracking the ‘Follow’ targets movement

Please join me in this 6 part series that is going to look at Unity’s 6 different Body Settings available in Cinemachine’s Virtual Cameras, with examples. I have previously touched on a few of these in some detail, but just for fun let’s dive a bit further into the settings and get some examples flowing.

Body’ refers to the movement of the virtual camera in the scene and works hand in hand with the ‘Followtarget field, covered in this article.
Whereas ‘Aim(as covered in this article)refers to how the virtual camera aims and tracks the ‘LookAttarget.

If the ‘Followtarget field is left empty (apart from not having a target to follow, obviously), you will also be met with this error:

Body showing an error as there is no Follow target

When a Follow target is placed into that field:

Problem solved! Keep this in mind for the rest of the series also.

3rd Person Follow Camera

If you are unfamiliar with the term 3rd person in gaming, it is essentially looking at your character from a distance (as an onlooker) and not from the viewpoint of the character directly. Case in point below:

Run egg man, run!

Now for Cinemachines virtual cameras, the 3rd person camera is going to stay in a locked offset position relative to the Follow target, even when the character moves and rotates.

3rd person follow camera tracking the ‘Follow’ targets movement
3rd person follow camera tracking the ‘Follow’ targets rotation

These settings can be adjusted so that the camera can have a different offset position, damping effect or even obstacle layers/tags where the camera doesn’t collide with. Let’s take a peek at these below:

3rd Person Follow Settings

The 3rd person camera setting position is defined by 3 different pivot points — The origin of the ‘Followtarget (A), the shoulder (B)and the hand (C) .

The hand is vertically offset in relation to the shoulder. This photo is quite deceptive, the red line is actually a straight line behind egg man.

3rd person follow body settings

Damping

I have previously covered damping in this article, but I will also touch on it here. Damping looks at how quickly the virtual camera reacts to the movement of the target (egg man) on the X, Y and Z axis. The smaller the number, the more responsive the camera is to the targets movement.

Below, the damping settings are all set to 0. Notice that the virtual camera movement is very crisp and responsive.

Damping on X, Y & Z axis all set to 0

Now if we increase the damping to 10 on the Z axis (which is the way egg man is running), notice that the virtual camera is almost trying to catch up and it is lagging behind.

Z damping of 10

Rig

Shoulder Offset

The shoulder offset is a local space pivot position that is calculated relative to the ‘Followtargets origin position.

E.g. If I was to set all the X, Y & Z shoulder offset positions to 0 (and in conjunction with a camera distance of 0), then the virtual cameras position will be the ‘Follow’ targets origin position.

Shoulder Offset X, Y & Z axis set to 0
Virtual Camera is now the ‘Follow’ targets position

Vertical Arm Length

This is the vertical offset of the hand relative to the shoulder and is the A in the picture above.

Camera Side

The camera side refers to which side of the ‘Followtarget it will sit or somewhere in the middle. Over the left shoulder being 0, right shoulder +1 and anything in between.

This gif shows the movement from 1 to 0 (right to left):

Moving the camera side from 1 (right) to 0 (left).

Camera Distance

This refers to the distance from the hand (A) to the camera.

Moving the camera distance from 0 to 7.

Obstacles

Camera Collision Filter

The camera collision filter will avoid collisions with game objects on the specified layers:

Watch as the camera sharply darts to the side to avoid a collision with the rock which has a layer called ‘Obstacle’ on it. How sharply the camera will jump is also dependant on the camera radius (below):

Virtual camera avoiding an obstacle with a specified layer and camera radius of minimum (0,001)
Virtual camera avoiding an obstacle with a specified layer and camera radius of maximum (1)

The camera will auto adjust once it is around the obstacle to go back to the set offset position.

Ignore Tag

Compared to the above, obstacles that have a specific tag will be ignored.

It seems that through some testing, if I was to have a camera collision filter on the rock game object (to avoid colliding with the rock) and also an ignore tag (so the camera went straight through it), it ignores the initial and obeys the latter (maybe cancelling each other out), as shown below:

Ignore tags
camera going through the obstacle

Camera Radius

The camera radius refers to how close the virtual camera can come to an obstacle, between 0.001 and 1. The lower the number, the closer it can get and vice versa (as shown above in the camera collision section).

Can you use the 3rd person follow camera to create a first person camera?

The simple answer is Yes! A very basic one. If you were to adjust the shoulder offset and camera distance position in the Rig section so the view is from the characters, then mission complete!

1st person camera view
Repurposing the 3rd person follow camera to be a first person camera

How Would We Make Changes at Runtime Through Scripting?

Great question you asked! Let’s take a quick look.

Normally when we are trying to access these settings through scripting you would get there through the CinemachineVirtualCamera component (which is very logical, and is the correct way to access these settings shown below):

However, when trying to adjust the Body and Aim settings, they have their own built-in classes:

Body and Aim Settings with their built-in classes respectively

Now, if you got through this whole article and were more interested in the 3D low poly animated egg that will be the focus of this 6 part series, then please head over to the asset store and show the creator some love (link below).

--

--