Make Camera Follow Player with Cinemachine in Unity

Objective: use cinemachine to make the main camera follow the player.

First of all we have to install a cinemachine. Go to Window > Package Manager > In the search bar type cinemachine and install the package.

Now in the unity editor we have a new tab called cinemachine. We have to go there and select the option “Create Virtual Camera”. This action is going to create a new gameobject for the virtual camera and it’s going to add a new component in the main camera called cinemachine brain. This component is in charge to control all the cinemachine behavior.

In this example we only want to make the camera follow the player. You have to select virtual camera and add the player game object to the follow and look at properties in the inspector.

Cinemachine offers a lot of utilities for make awesome use of the camera for the game and cutscenes but in this tutorial we only are focused on making the camera follow the player. Another thing that you can do to improve the camera movement is modify the aim properties. In the game window you can see a red area, a blue area and an empty area. Each area identify a aim property from the virtual camera, in this case I only move the blue area called soft area and it indicated when the player enters in this area the camera has to start moving.

And that’s it!!! We have a functional cinemachina camera follow feature.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store