Hollywood is notorious for using real-life dolly tracks to get smooth cinematic shots that literally roll through the scene. Using a virtual dolly track in Unity can achieve the same results. Let’s get things moving by mounting a virtual camera to a virtual dolly track!
To use the dolly track, you will have to have the Cinemachine package installed. At the top of the screen select the Cinemachine drop-down, and then choose Create Dolly Camera with Track.
If you can find it in your scene, this is what the dolly track should look like.
Your hierarchy should also show a Dolly Track as well as a new virtual camera.
Selecting the Dolly Track will show some added information in the inspector. The first thing to do is to press the giant Add a waypoint to the path, button.
The default waypoint of 0 is generated. Press the plus icon to add another waypoint to the path (1).
The middle arrow shaped handle can be used to move the waypoints in the scene view, while the furthest handle is used for making a curved path.
An overhead shot better shows the waypoints being dragged apart with the handle on the dolly track.
The path is made into a curve by moving the furthest handle. If you have ever used the pen tool in illustrator before, this might feel like familiar territory.
Now that my dolly track is set, you can see the #0 waypoint at the beginning of the dolly track, and the #1 waypoint at the end (small white sphere with a number on it).
Expanding the Path Details dropdown in the inspector will show all waypoints on this particular dolly track, as well as the currently selected one.
Now with the side view virtual camera selected, under the Body drop-down, change from Transposer to Tracked Dolly.
The top dialog box called Path, is looking for a dolly track. Drag the current dolly track into this slot from the hierarchy to assign it.
Now with the dolly track added to the virtual camera, I can toggle the path position to change waypoints, as seen in the Gif below.
A path position of 0 places the camera at the first #0 waypoint on the dolly track, while a path position of 1 places it at the #1 waypoint.
In order to animate the camera between the waypoints on the dolly track, an animation track needs to be added to the timeline.
The side view virtual camera on the dolly track is now assigned by dragging it into the animation track.
I repeat this process for the overhead camera that will pan upwards as the scene ends.
I am actually about to animate the overhead can in this shot, but let’s talk about doing the dolly track animation. After pressing the red record button, I select the Side view virtual camera in the hierarchy. I want the beginning of my scene to have the camera at waypoint 0, so I move the cursor in the timeline to the beginning of the cutscene, and then toggle the path position number in the inspector on the virtual camera to create a keyframe. Zero is the final numeric entry to place the camera at waypoint zero when the cutscene begins. The cursor is then moved to the end of the clip where the side shot camera changes to the overhead view. The path position is toggled to 1 to create another keyframe, and then recording can be stopped. That’s it!
I want the side view camera on the dolly track to keep it’s eyes on Darren, the player in this game. The cinemachine virtual camera has a powerful Look At dialog box that takes a game object assignment as a target for the camera. I drag the actor Darren game object into the box to assign him.
This Look At method is so powerful that the camera will keep Darren locked to the center of the screen, which I don’t want. I want to try and retain the cinematic shot that uses the rule of 3rds over a family portrait style centering. This is where the Tracked Object Offset comes in. I provide an offset to the X and Y axes to keep the off center look I desire, while still tracking Darren on the camera. The Dead Zone Width is set to zero, enabling the camera to immediately move smoothly regardless of if Darren is in the dead zone or not.
The final animation in the title image is the result of this tutorial style blog, albeit with the file size compressed for use on Medium.
I hope you enjoyed this voyage into using a dolly track in Unity3D. Thanks for reading and have fun making your very own cinematic cuts!