Make the Main Camera Look At the Player.

Look at the player all the time during the game.

Rusben Guzman
Nov 9, 2021

Objective: Create a script to make the camera look at the player.

Create a new C# Script called LookAtPlayer and assign it to the main camera.

In the script we have to declare a variable of type Transform to store the player transform. Then in the Update method we have to use the function transform.LookAt() and pass the player transform as a parameter. The LookAt function is going to readjust the camera to look at the player all the time.

And that’s it!!!! Our camera follows the player perfectly.

--

--

Rusben Guzman
Rusben Guzman

Written by Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

No responses yet