Cinematography in Unity — Dolly Tracks

Joshua Nielsen
5 min readDec 24, 2021

Using dolly tracks for smoother camera movement

Photo by Film Photo Tips from Pexels

We continue our study of cinematography in Unity with a quick look at making use of dolly tracks for our virtual cameras. What do I mean by cinematography in Unity? By that I mean the intelligent use of Unity cameras and visual tricks to make the best looking games we can.

What’s a dolly track?

A camera dolly is a wheeled platform or similar tool which is used in real world filmmaking to move the camera during filming. With a camera dolly, the camera can be moved along the ground to create a very smooth shot.

Dolly tracks are a feature of Cinemachine that emulates this functionality within Unity. With them, we can create smooth camera movements along predetermined paths.

Making a dolly track

In the Cinemachine menu, find the option “Create Dolly Camera with Track” and select it. This will create two new game objects — a Cinemachine virtual camera (which we have seen before) and a Dolly Track.

The Dolly Track is a game object with the Cinemachine Path component. Here’s what it looks like in the Inspector:

Dolly Track object in the Inspector window

Of what we see here, what is arguably the most important aspect is the waypoints. This is what defines the path of the dolly track.

Working with waypoints

Creating a waypoint is very simple. All you need to do is click on the little plus sign in the corner of the Waypoints section. Doing that creates a waypoint and allows you to see the details of that waypoint.

Waypoint details in the Inspector window

So what we can see here is some fields that represent where the Waypoint is, and how the Dolly Track will move between Waypoints. Let’s see what the Dolly Track looks like in the Scene window.

A Dolly Track in the Scene window with three Waypoints

Here I’ve created an example where the Dolly Track object itself is positioned in the center (near the security guard model), and the three Waypoints are positioned around it. The Dolly Track can be a bit tricky to see at first, but once some Waypoints are set up I think it becomes very clear.

Tangents

The tangent fields are how we get curved lines for our Dolly Tracks. This feature is very powerful, but can definitely be tricky to work with. Fortunately, we can work with them in the Scene window by selecting Waypoints in the Inspector. When this is done, we can see two editing tools in the Scene window. One is for the position and the other is for the tangent.

Here is an example of the tangent having been manipulated in a very basic way.

Dolly Track tangent in action

Virtual Cameras on Dolly Tracks

Now let’s take a look at what the camera is doing.

The Cinemachine Virtual Camera in the Inspector window

Three things I want to focus on here, all in the Body section. The first is how the Body section is configured. You’ll notice it is set to “Tracked Dolly”. This is how we set a virtual camera to use a Dolly Track.

The second is the Path field, which has been set to our newly created Dolly Track. This field is how we can set or change the Dolly Track of our virtual cameras if we need to.

The final thing I want us to look at is the Path Position field. What this field represents is the Waypoint on the Dolly Track that the camera is currently at. If you have an example set up, go ahead and change that value and see how the camera changes position.

Dolly Tracks and Timeline

Finally, let’s see the real power of Dolly Tracks by using one in a Timeline.

When we changed the value of the Path Position of the camera previously, this would just instantly change the camera’s position. What we really want is to have our camera move smoothly from spot to spot. This is where Timeline comes in.

If we create a Timeline directly on the virtual camera, this will attach both a Playable Director and Animator component on the camera. In the Timeline, we will already have an Animation track with the camera as the object to animate. This gives us everything we need for this example.

So, in the Timeline we want to start recording on the Animation track. On this track we just want to create a few keys on the Timeline, each with a different Path Position set on the camera. In my example, I’ve created a Timeline where the camera moves from Waypoint 0 to 1 to 2 over the course of two seconds. Here’s the result.

Timeline of the Virtual Camera moving along the Dolly Track

Conclusion

Now we’re really seeing how these various features can come together to create something great. With Cinemachine and Timeline, we can really make some very cinematic experiences.

Speaking of cinematic, next time we’re going to look at a very easy trick for creating cinematic experiences. Until then, thanks for reading.

--

--