Unity and Cinemachine — Third Person Follow
Looking deeper at the 3rd Person Follow option
Continuing our deeper look at the options for a virtual camera when it is set to Follow another object, today we’ll be examining the 3rd Person Follow option.
3rd Person Follow
Unlike the Transposer option that we just recently explored, the 3rd Person Follow tracks both its target’s movement and rotation. In addition, as we will soon see, the 3rd Person Follow has a number of options that make it in some ways ideally suited for games set in the 3rd person perspective (imagine that!).
Examples of 3rd person perspective games include the Mass Effect and Max Payne games series, or any number of vehicle based games that allow for a perspective outside of the vehicle.
Unlike with the Transposer, there is nothing as significant as Binding Mode to worry about with 3rd Person Follow, so let’s just get straight to the options.
Damping represents how responsive the virtual camera is to maintaining its position relative to the target when it is moving. A low value in a damping field represents a rapid response in matching the movements of the target.
We’ve seen damping before, and it’s no different here. Note that we do have separate damping field for all three axes.
This is where it gets interesting. The Rig section of the Body is what determines the camera’s position relative to the target, but all of these options allow us to be very sophisticated in building our virtual camera.
In fact, it may be a bit too sophisticated for me to be able to explain properly, but I’ll give it a shot.
There are four points of interest when discussing the rig. These are the origin, the shoulder, the hand, and the camera.
- The origin is the target’s position. When the target pivots horizontally, the rig rotates with it around this point.
- The shoulder is determined by the Shoulder Offset fields. The rig rotates vertically about the shoulder. The shoulder is also affected by the Camera Side field, which allows us to switch the shoulder position from right to left or anywhere in between.
- The hand is offset from the shoulder by the Vertical Arm Length field’s value. The arm length affects the target’s screen position when the virtual camera rotates vertically.
- Finally, the camera is, of course, the virtual camera itself. The camera’s rotation parallels the target’s rotation, but its position is a specified distance (the Camera Distance field) behind the hand. The camera looks at the hand by default.
I realize that may not be entirely clear. Be sure to check out Unity’s documentation for further explanation.
In a nutshell, I think what we can take from this is that the rig allows us very intricate control of the virtual camera’s positioning. Let’s step through the options now.
- Shoulder Offset: Determines the position of the shoulder pivot relative to the target.
- Vertical Arm Length: Vertical offset of the hand in relation to the shoulder.
- Camera Side: Specifies which “shoulder” the virtual camera is positioned over. A value of one represents the right side, and zero the left.
- Camera Distance: The distance between the hand and the camera.
Obstacles — The Camera Collision System
The 3rd Person Follow option has a collision resolution system so that it automatically attempts to avoid situations where the camera would find itself inside of an obstacle. The Obstacles section has options that allow us to configure how the virtual camera responds to these situations.
- Camera Collision Filter: Specifies which layers (Unity layers) will be affected by collision resolution.
- Ignore Tag: Obstacles with specified tags (Unity tags) will be ignored by collision resolution. It is recommended to include the tag of the specified follow target.
- Camera Radius: Represents how close the virtual camera can get to obstacles that are not being ignored before adjusting its position.
That concludes our examination of the 3rd Person Follow option. Next time, we’ll continue by exploring the Orbital Transposer option. Thanks for reading.