The Difference Between Dolly Camera with Track & Dolly Track with Cart in Unity’s Cinemachine
Objective: To understand the difference between Cinemachines Dolly Camera with Track and Dolly Track with Cart options.
Yes that was a bit of a tongue twister. And yes they are in fact different, so let’s take a look at them!
How to Add Them to Your Scene
Right click in your Hierarchy window → Cinemachine → ‘Dolly Camera with Track’ / ‘Dolly Track with Cart’ or head to the top tabs and look for ‘Cinemachine’ → Create → Dolly Camera with Track’ / ‘Dolly Track with Cart’.
Dolly Camera with Track
Firstly, the Dolly Camera with Track has been covered in this article quite extensively so I won’t go into too much detail here, however, essentially this is a virtual camera that is placed on a dolly track and only is allowed to move along the predefined path (track):
When you add one into the scene, it will automatically create a CinemachineVirtualCamera component to a game object and set the ‘Body’ option in the Inspector to ‘Tracked Dolly’. At the same time it will also create a default dolly track seen below:
This also contains the ‘Auto Dolly’ system which moves the virtual camera automatically to the best position on the track dependent on the target’s position. The cart DOES NOT have this feature.
Dolly Track with Cart
When this is added to the scene, it also creates a default dolly track that is similar to the ‘Dolly Camera with Track’ option.
However, instead of creating a virtual camera, it creates a CinemachineDollyCart script component attached to an empty game object (cart) in the scene as shown below:
Instead of tracking a target game object using ‘Follow’ and ‘LookAt’, it simply moves along a predefined path at a specified speed:
You will see as we start the scene, even though the player hasn’t moved, the cart will just continue on it’s way down the track at the set speed to the predefined end point.
Also notice that it doesn’t have any aiming features. To get around this let’s combine both the virtual camera and the cart.
Combining the Virtual Camera with the Cart
In the Inspector on the CinemachineVirtualCamera component, let’s drag and drop the cart into the ‘Follow’ field. Let’s also make sure in the ‘LookAt’ field that we have the player capsule in here.
Now let’s hit ‘Play’ and notice that the cart will continue to move along the track at the same speed as before, however, we now have it aiming at a target whilst moving:
You can’t unfortunately see the other green track which has the cart on it, but the virtual camera is following it!
Useful Links
Cinemachine Dolly Cart