Hello, Dolly: Animating Cinemachine Virtual Cameras on the Dolly Track

How’s it go, Dolly?

Today, I’m going over the bits and pieces of the Cinemachine dolly track — one of many ways to plan and animate the movements of Cinemachine virtual cameras in your Unity 3D scene. Throughout, I will make only the mandatory minimal references to a certain Broadway hit of 1964, as required when talking about dolly tracks.

First thing we need to do is arrange the scene.

Gifs were much smaller in 1969.

This particular cutscene is for when the player has failed at a stealth challenge and is captured. Game Over. The cutscene has already been prepared for me, all I have to do is drag it into the scene. Once there, all the actor objects and their child objects and components will appear. If I were to press play now, they’d jump into their pre-arranged animations.

I’m pretty much playing with dolls right now.

Once I have things arranged as I like them, I’ll need to create a virtual camera for each shot in the scene. This scene has two — one: a full shot orbit on the dolly track, focusing on the protagonist, and the other: an overhead shot that tracks upward as the game over menu fades into view.

Now, on to setting up the dolly camera. First, I’ll set the virtual camera’s initial position. The easiest way is to position the scene view to match the intended shot view, select the virtual camera in the Hierarchy, and then press Ctrl+Shift+F. The virtual camera will plop into the exact position and orientation of your Scene view. From there you can use the transform handles to adjust the camera using the Game view to find an aesthetic composition.

That there’s a nice composition.

My virtual camera guides are set with a Deadzone Width and Height of 0.333 to represent the Rule of Thirds. Make sure to return the deadzone to 0.1 after composing the shot, so that the camera responds to the deadzone appropriately.

Speaking of the deadzone, we also need to drag the player’s Head object into the “Look At” field of the Virtual Camera. This will keep the player’s head inside the deadzone while the camera moves along the dolly track.

After that, create a new Dolly Camera with Track from the Cinemachine menu:

Delete the camera created with the dolly track, and drag the dolly track object onto Path blank in the Body section of the the virtual camera we already have set up for this shot.

Set the body to “Tracked Dolly” to get the Path option.

Next, let’s set up the dolly track itself. Select it in the Hierarchy. You’ll notice there are three sets of transform handles for this object. One is the track object as a whole. The other two belong to the first (well, okay, the 0th) Path Position. The numbered object controls the position of that node, and the other dictates the angle of curvature to the next node.

By adding and positioning nodes, we can construct a continuous, smooth arc around the group of actors, creating the effect our director requires for this shot.

Now let’s animate our cameras.

The process for animating these is identical, the only difference is that the dolly camera will be bound to the track. Since Medium doesn’t like me to include long animated gifs, I’ll show you how to make the animation for the overhead shot (which is shorter).

First, let’s get our overhead virtual camera in position.

Now it’s time to set up the timeline.

Select the cutscene object in the Hierarchy and click the “Create” button in the Timeline. This will automatically add two components to the cutscene object: a Playable Director, and an Animation Controller. An empty Animation Track will also be created in the Timeline. Right-click and remove both the Animation Controller and the Animation Track — they aren’t necessary for our process. Unity assumes we will need them on our container object, but we actually want them on the virtual camera.

Click the + button and select “Animation Track” from the dropdown. Do this twice — the first will be for our actors, the second will be the for the virtual camera.

Into the first track, drag the object from the Hierarchy that holds the actor animation controller. Then drag the animation itself (found in the Project View) into the timeline. Finally, drag your virtual camera from the Hierarchy into the space provided in the new track. You will be prompted to add an Animation Controller component to your virtual camera, which is exactly what we want.

The last thing we need to do before we can record our camera movement is to add a Cinemachine Track to the Timeline. Into this track, we’ll drag our two cameras, and arrange the cut between them where it needs to be in respect to the actors’ animation.

Once all that is done, position the time index where we want the shot to begin and hit the “Record” button on the virtual camera track. You have to alter the transform of the virtual camera to establish a keyframe. Make sure to readjust the camera to the proper starting position afterward, if necessary. Next, drag the time index over to the end of the animation and translate the camera to some point high above the player (but where the ceiling is not blocking any part of the view). Finally, turn off the “Recording.” When you’re done, you should have two keyframes on the timeline at the beginning and end of the camera tracking.

Here’s a (slightly sped up) look at the results (sorry, as I said, Medium doesn’t like gifs longer than a few seconds):

After that, all we need to do is follow the same steps to animate the dolly camera.

That’s one animated Dolly.

Thanks for reading. In the next article, I’ll cover some other ways to animate game objects on the Timeline.

--

--

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