Working with Cinemachine
Advance features of the Virtual Camera
So far, we have been working with The Transposer setting of the body settings. If you select the drop down menu, you will see that there are a lot more settings that we can use, and each setting can provide a new unique function. In this short article we will go through all of the settings.
3rd Person Follow:
Just as the name implies this camera setting is quite popular with games that wants to show the players back so the camera is situated behind the player. Examples of famous games that use 3rd person view are “Fortnite, Dead Space, God of War”.
The first settings which you want to adjust would be the “Shoulder Offset” under the Rig setup, these values would adjust the positioning of your camera so you can place the camera in the desired positioning.
The next setting without the Body which should be adjusted would be the “Camera Side”.
This affects the side which the camera is behind the character, be it the left or right. This is great since we can access this setting by script and can be adjusted in a custom settings for your game.
The next few important settings which you can adjust are the “Obstacles” and the “Camera Collision Filter”. This setting allows what can be collided by the camera and what shouldn’t. For example, if your player walks too close to the wall and as you rotate the camera, you can setup so the camera will collided with the wall so the objects behind the wall won’t be exposed. Of course this requires the use of Cinemachine Extension which we will go over much later.
The next setting for the Body Camera is the “Orbital Transposer”. This allows the camera to pivot around the player as we drag across the screen. In order to make the Orbital Transposer to work, we need the Look At function to also be active.
Remember to have the Look At function active and the slot fitted with your player game object. Then have the Aim function set to “Composer”.
So some of the settings that we can adjust within the Orbital Transposer would be the “Follow Offset”. This sets the distance between the camera and the player. Keep in mind that now we are also using the Aim function of the virtual camera, we can adjust the height of the camera via the Aim Composer.
Another setting which we can adjust that is quite useful, is the “Re-center To Target Heading” feature. This built in function is the ability to re-center the camera to the back of the player after a few seconds.
You can adjust the wait time before the camera moves, and also the speed of the camera when it does the re-centering.
The next setting that can be adjusted would be the “Value Range” under the “X Axis”. This limits the camera angle which the camera can travel.
With a setup of -90 to 90, the camera is now stuck at certain pivot points and can go any further.
Another interesting Body camera setting is the “Tracked Dolly”. This feature allows the virtual camera to follow a preset track so you are setting up an nice pan across a set area. To start with an Dolly track, we need to create an Virtual Camera with Track under the Cinemachine menu.
This will create an Track with an Virtual Camera attached to it. Once you have, you will see two new objects within the Hierarchy and also within the Body component, the Dolly Track is set to the path.
In the scene you will also see a thin green tack along with the virtual camera attached to it. In the Dolly Track object, you will see some settings within the Inspector, you are able to change the Color and amount of waypoints the track has. By default you are presented with two waypoints, but you are able to add more and adjust their position via the XYZ values.
If you select one of the waypoints in the Inspector you can see the active point in the Dolly Track.
Back in the Virtual Camera setting, Under the Body tab you can see the “Path Position” with an number beside it. This number is the indicator for the waypoint number (aka. Zero is with waypoint Zero, One is with Waypoint One) Without scripting, I can manually move the camera via the Path Position just by changing the value from 0 to 2.
Another useful function for the Tracked Dolly setting is the “Auto Dolly”. Instead of manually changing the Path Position, with the Auto Dolly enabled, the camera is able to follow a set target. If the Set target is moving, the camera will follow but limited to the track.
So if you have a shot that required a camera pan across the room, but you only want the camera to move when the player is moving, this will be your setting.