Unity Cinemachine: What are Follow and Lookat in Virtual Cameras?
Goal: Learn the difference between Lookat and Follow and dive deeper into Lookat (aim)
This section was learning about how to create virtual cameras that utilize Look At or Follow. The key difference is how the camera behaves when given an object’s transform. For follow the camera position (body) moves with the object it is tracking, and for lookat (aim), the camera’s body or position stays in place, but its orientation changes allowing you to rotate the camera. The camera will track the object but at a stationary position. When combining both of these together, we can create some interesting cameras such as 2.5D, an orbital camera that gives a 360 view of the player. In this section, I will be going through each of the Lookat (Aim) components.
Look At Components
In the above article, I went into further detail about the aim composer and each property/field. The next components below are built off the composer with added features.
Group Target
Group target is a script provided by Cinemachine that you can attach to an empty game object. This script allows the Virtual Camera to track multiple objects and keeps them in the frame. It is required to have an empty object that contains the CinemachineTargetGroup script. Then add the objects you want to include in the group. Then drag the target group’s empty object into the virtual camera’s lookat field.
Hard Look At
Locks on target and never moves away
POV
Allows user input (mouse) to control the camera. You can limit the angle of the camera by adjusting the value range.
Same As Follow Target
The camera will mimic the orientation of the follow target if given one.