Blending Between Virtual Cameras in Unity
In the last article I showed one way to animate Cinemachine virtual cameras using an animation track with keyframes in the Timeline. Here’s another quick trick for getting the same effect, without the hassle of recording keyframes.
For this, we’ll need to block our actors, load the actor animation into the timeline, and create two virtual cameras. The first camera will be our beginning shot, a full shot of the protagonist standing before their ultimate goal: the museum vault door.
The second camera will be our final shot: a closeup of the protagonist looking at the camera victoriously.
Once we have both cameras in position, we’ll need to drag the Main Camera (with the CinemachineBrain component attached) into the Timeline track list. This will create a Cinemachine track, with the Main Camera slotted. Onto the timeline itself, drag the two virtual cameras. When you’re done, you should have a setup something like this:
If you play this animation as is, there will be a simple jump cut between the two cameras at the point set on the timeline. We can blend this into an animated transition very easily by clicking on the closeup cam on the timeline and dragging it into the full shot cam’s timeline spot.
Now, for the duration of the timeline where both camera’s are present, Cinemachine will seamlessly blend between the two shots before ending wholly in the second shot.
Let’s take a look:
That’s it for today’s article. Tomorrow will built one final cutscene, and I’ll show you how to line up audio tracks and animation on the timeline in Unity.