How to use a Dolly Track in Unity
The idea of a Dolly track originated from the film industry, where a camera was fitted on a dolly that rolled/slid over a track to smoothly follow a subject along a path. Unity provides the same ability by using the Dolly track feature in Cinemachine.
In this article, we will create a dolly track that allows a camera to smoothly move along a path. There are two phases, one to set up the Dolly track with “waypoints” and the second phase to animate it between these waypoints.
Set up the Dolly Track
To create a Dolly track, go to Cinemachine > Create a Dolly Camera with Track.
This creates both a Dolly track and a virtual camera. Since we already composed a virtual camera, we have no need for this new virtual camera so I am going to remove it and re-organise the hierarchy.
Now, let’s reposition the Dolly track closer to our actors by making sure it is selected in the Hierarchy and pressing CTRL-ALT-F to move the selected game object to the scene view. You may need to adjust the height etc.
Next, we want to use the Full shot virtual camera with this track. On the virtual camera, under Body, set it to Tracked Dolly.
You will notice that you can not see this Dolly Track in the scene view. It is only when you start adding waypoints will the track be visible. With the Dolly Track selected, in the Inspector Window, add a waypoint to the path. This will create the first waypoint.
In the Scene view, you can now see two objects that represent each of the two waypoints(0 and 1). We want to create a curved path around the security guard and then heading towards our main character. We achieve this by using the Transform and adjusting the curve anchors handles.
In the Inspector Window, click on each of the waypoint numbers to select them in the scene view for adjustment.
Animating the Dolly Track
To be able to animate the virtual camera along the Dolly track, we first need to add an Animation Track to the Timeline. I am going to select the game object that has the Playable Director for this cutscene and in the Timeline, add an Animation Track.
Drag on the virtual camera we want to animate and it will create an Animator Controller component on this virtual camera.
Next, on the Animation Track, we will start the recording, where I will set the start of the animation to waypoint 0 and the end to waypoint 1 so we have a transition between the two waypoints.
That’s how you can add and animate a camera along a dolly track.
If you enjoyed reading this article give me a Clap, also if you would like to see more, “Follow” me, so you may be notified of future releases. You may also send me a message if you need any further help.