Cinemachine’s Virtual Camera systems have two main tracking elements, Follow, and Look At.
Follow, handles the camera’s movement, whereas Look At, handles the rotation or aiming.
When using Look At, we get a handy overlay on our Game view. With the default Aim settings, we see the image above, and as we move the target object around, the Virtual Camera acts as follows.
Note that the camera’s position never moves, but it keeps the target object in the dead center of the frame at all times.
To make more cinematic shots though, we need to be able to manipulate different values of how this works. When we add a GameObject to the Look At variable, we can then make use of the Aim settings.
Firstly, we have the Aim type, which allows for different: control and logic over how the Virtual Camera rotates, these are as follows:
- Composer: This allows for controls to keep the Look At target within the camera frame.
- Group Composer: This acts the same as above but for multiple targets.
- Do Nothing: This prevents any rotation of the Virtual Camera.
- POV: Rotation control is based upon User Input. Holds a range of variables to manipulate how this works.
- Same As Follow Target: If a Follow target is active, the Virtual Camera’s rotation matches that of the target.
- Hard Look At: Keeps the target in the center of the frame, similar to Composer, without any control.
Composer mode allows for the most manual manipulation, so we will continue diving into the different variables with this mode in mind.
The first section consists of one variable, the Tracked Object Offset, this is a Vector3 that allows us to set the target in the center of the frame, to be an offset position from the target object.
Next is the Lookahead section, this allows us to estimate where the tracked object will be in the future. (If it’s moveable of course!) Using the Time and Smoothing variable, we can manipulate how far ahead of the tracked object the camera will move, and how much camera jitter is encountered. We can also toggle a bool to ignore movement on the Y axis, which is more applicable to 2D games.
Below this, is the Damping section. Damping, is how responsive the camera movement is to keep the tracked object within the dead zone (more on this soon). Smaller numbers result in a quicker rotation of the camera, with larger being slow to respond. This is most noticeable for fine tuning when the tracked object is made to move completely out of the current shot.
Screen X and Y allow us to apply an offset to the target object relative to the center of the camera, letting the tracking follow the object in any given position. Different to that of the Tracked Object Offset in the sense of the yellow tracking dot still being in the center of the object in question.
Along with this, is the Dead Zone, this is the clear region within the blue that dictates that any movement is ignored, until the cube above enters the blue area, the camera won’t move.
The red area of the frame, is the Soft Zone. When the tracked object is in this region, the camera will rotate to try and keep it within the dead zone. The speed of doing so, being dictated by the Damping settings.
Lastly, Bias allows the soft zone to be positioned differently to the dead zone, allowing for stronger movement in certain directions.
Manipulating different variations of these variables, can allow for both very similar, and vastly different methods of achieving the same result. Below is a few examples following a tracked object with a simple movement animation.