Using Dolly Track in Unity

A dolly track allows you to set up a path and have a virtual camera follow it to get shots where the camera moves around the scene. In this tutorial, I will show how to create a dolly track that allows the camera to move around the knight in the picture.

First, make sure to install cinemachine for the project you are working on.

Now create a virtual camera by right-clicking the hierarchy and selecting Cinemachine => Virtual Camera

Because you will add the virtual camera to the dolly track it is not as important to get the camera in the correct spot.

What you can do is create an empty game object and call it to look at. Position this game object on the knight and parent it to the knight so the object will follow the knight when it moves.

You will now add the look at empty game object to the virtual camera where it says look at. This will have the virtual camera focus on the game object.

To create the dolly track right-click the hierarchy and select Cinemachine => Dolly camera with track.

By default, the dolly track has CinemachineSmoothPath attached to it.

Delete this component and add the cinemachinepath component instead. This will give you more control of the dolly track.

Now when you click on a waypoint in the dolly track you will get three boxes that will allow you to adjust your dolly track.

From left to right the first box allows you to move the whole dolly track, The second allows you to change the location of the specific waypoint you selected, and the last allows you to change the trajectory (or tangent) of the path. The last one is how you make the camera curve.

To add your camera to the dolly track select the virtual camera and change the body from transposer to dolly track.

This is where you will drag your dolly track into the path slot.

Now to get the virtual camera to pan around the knight you will use the timeline window.

You can dock this window next to the console and dock the game view next to the scene view.

Now create an empty game object and for this example, I named it animation. Drag the virtual camera, dolly track, and knight into the animation game object. This will help with organization in the hierarchy.

With the animation game object selected create a new timeline using the timeline window

Now clear the animation slot and add your virtual camera to it. It will ask you to create an animation component if one does not exist. Select yes for this.

To record the animation select the red dot.

At the beginning of the animation drag the white bar to the 0 position and set the path position of your virtual camera to 0 in the body section. This will set the virtual camera to the first waypoint at the beginning of the animation.

Now drag the white bar to the length you want the animation to run and set the path position to 1.

You can now hit the red dot again to stop recording. You will be able to hit the play button in the timeline window to preview your animation.

To learn more about dolly tracks in Unity check out the official documentation using the link below:




Unity Game Developer and C# Programmer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Get Macros from an Excel File in C/C++

5 Best WordPress Form Builder Plugins- Compared!

How to Identify IP Address Intelligence in Node.JS

How to convert Markdown MD to HTML format in PHP

Introducing Laravel Test Watcher

How to Part-of-Speech Tag a String of Text in Go

Get A BigQuery Data Warehouse Ready In Minutes

Must Read Oracle Retail Interview Questions

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matthew Clark

Matthew Clark

Unity Game Developer and C# Programmer

More from Medium

How to create a modular power up system in Unity

Day 116: Jump and Animation Part 2

High-Definition Rendering Pipeline in Unity

How to Merge Local Unity Projects to Github Repository