Camera! Follow Me!- Game Dev Series 92

Objective: create a following camera by using Cinemachine.

We have used Cinemachine virtual camera to make some cutscene. This time we will use it to replace the game camera to follow Player.

In this article, we will set a Cinemachine camera as main camera and adjust the rotating issue of Player.

Start with virtual camera

Create a virtual camera into scene. If you have no Cinemachine drop down menu from the top, you may install it from Package Manager.

Adjust the camera in Inspector. Drag in Player gameobject to “Follow” and “Look At” to make sure Player is the only target.

We can also adjust some value under tab “Aim” to present a better angle.

Rotating issue

However, if you play the game in this way, you might see this.

The camera also rotate when Player has rotated. Because we make camera follow Player but we rotate the whole gameobject of Player when turning around.

To fix this, we can simply adjust the rotation only on model gameobject. That way the facing of Player gameobject would never change.

Create a gameobject variable in Player script, and use it to replace the origin rotate gameobject.

And now camera would perfectly follow the Player.




A passionate gamer whose goal is to work in video game development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

7 Reasons Why Startup Companies Use SaaS And What You Need to Know About SaaS

Am I Too Motivated and Ambitious as a Junior Developer?

Catgirl Weekly Progress Report — 12–29–2021

Effort Estimating: Person-Days or Story-Points?

Value-Based Classes and Domain Modelling in Kotlin

Watson OpenScale and Custom Serve Engine

Hi, in this article, we will be looking at How to add user authentication feature into your Django…

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
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Building A Stealth Game — Helping Your Guards “See”

Day 103: Creating A Ledge Grab in Unity Part 1

Creating An Advanced 2D Player Controller Without Any Unity Components! (Part 1)

Adding a burst laser powerup