How to Dolly/Track a Camera in Unity
We’ve previously looked at how to create Dolly cameras with their respective track, — read more here — which allows for the camera to move along a path based upon the follow target. We set this up from scratch, but we can also easily use a Cinemachine Dolly Camera with Track which immediately sets up the appropriate virtual camera with a path assigned to be edited.
Additionally, we can make use of a Cinemachine Dolly Track with Cart, which allows us to automate the movement along the path. The Dolly Cart component, requires a path, in which we can then define a movement speed, as well as manipulating the position manually or through script if required.
To pair everything together, we have our Virtual Camera’s follow target be the Dolly Cart, which in turn is fed the Dolly Path.
Now at runtime, our camera will track along the path at the given speed of the cart.
With our Player as the Look At target, we can achieve a smooth camera movement around the player. But we could also have an alternative or no C at all, to achieve a completely different look while following a path.
An extra bonus to Dolly Carts, is that they don’t necessarily need to be used with cameras. If we have a defined movement path for any game object, we can make use of a Dolly Cart as opposed to an animation. This can be beneficial as we can edit the path a lot easier than manipulating individual keyframes.