Constrain a camera to a path
Use a Spline to constrain the movement of a camera along a predefined and customizable path.
A Spline path is a path formed by a Spline in a scene. Use a Spline to specify a fixed course to position or animate a CinemachineCamera. Use the Spline Dolly behaviour to make your CinemachineCamera follow a Spline path.
To create a Cinemachine Camera with a dolly path:
In the Unity menu, choose GameObject > Cinemachine > Dolly Camera with Spline. A new Cinemachine Camera and spline appear in the Hierarchy.
In the Hierarchy window, select the new dolly spline GameObject.
In the Inspector or in the Scene View, add and adjust waypoints.
Any Unity spline can be used as a path in Cinemachine. Just drag it into the Spline Dolly Spline property field, and immediately the CinemachineCamera will be confined to the spline.
By default, Unity Splines contain no rotation data. Camera rotation will be inferred from the spline tangent at any point, combined with the world Up vector. To add rotation about the tangent, you can use the Cinemachine Spline Roll behaviour. This allows you to specify Roll values for any point along the spline. Roll values are used to rotate the camera about the spline tangent at that point, giving you more control over the camera's final rotation.
If a Cinemachine Spline Roll behaviour is added to the spline, all cameras and dolly carts that use the spline will see it. Alternatively, you can add the Cinemachine Spline Roll behaviour to the Cinemachine Camera itself, in which case the roll will only apply to it.