Objective: Install Cinemachine and create camera follow system!
We have been focusing on player animations and movements. If you have followed along with me, or made you own, we have a large level designed for our player however we can’t explore it since the camera doesn’t move. We are going to change that using Cinemachine.
To install Cinemachine we need to navigate to the Package Manager.
Scroll down until you find Cinemachine
Select Install, this will import the most up to date assets into your project.
When the install is finished you can close the package manager. There is a new tab for Cinemachine. This is going to allow you to create a virtual camera.
We use this virtual cam to compose our scene and set up our shot.
We need to back the camera up so we can see our level and player. Set the Z axis position to -10.
In the inspector there is a follow feature. If we drag our player in the camera will follow the player as they move left to right.
This works because when we added the Virtual Camera it automatically created a cinemachine brain on the Main Camera.
The brain tell the main camera to use the live camera, and the live camera is our CM Follow Cam, the virtual camera we created. Now our player is free to explore the level and the camera will follow!
Don’t be afraid to experiment with your virtual cameras, and I’ll see you in the next tutorial!