S
S
Sergey Grigorov2018-07-07 21:29:30
C++ / C#
Sergey Grigorov, 2018-07-07 21:29:30

How to make the camera follow the player?

Hello.
There is a certain cube (now it is my character). The camera hangs above him from above and slightly to the side. Previously, when the character was rotated, the camera would also rotate after it. I hung a script on the camera, which in Start() catches the current Rotation of the camera in Quaternion and in Update assigns transform.rotation the value of our quaternion. Now the camera does not follow the player, but orbits around him when the player turns ¯\_(ツ)_/¯
Goal: the camera should fly over the character at a certain height with an X 45 tilt (bird's eye view), rising and going down with our player. As I understand it, you need to freeze the Rotation of the camera in Y and Z, but I don’t know how to do it. Everything I've tried causes the camera to move in orbit around the player.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
ben007che, 2018-07-30
@Serjio-Grig

Sergey Grigorov take the camera and drag it to the player and that's it, no need to write scripts (this is my life hack)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question