Unity and Cinemachine — Third Person Follow

Photo by Thomas from Pexels

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!).

Cinemachine virtual camera with Body set to 3rd Person Follow

Damping

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.

Rig

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.

  • 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.
  • 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.

Conclusion

That concludes our examination of the 3rd Person Follow option. Next time, we’ll continue by exploring the Orbital Transposer option. Thanks for reading.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store