Hey all. Newbie here, please go easy on me. I recently started work on a simple player movement script.
I was following a tutorial. In the tutorial, you make the camera a child of a main controller. It basically checks mouse X and applies it to the whole thing. I got it working just fine, but the camera just kind of... stayed there. It doesn't rotate one bit. Here's the code that makes it work:
float mouseX = Input.GetAxis("Mouse X") * MouseSensitivity * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * MouseSensitivity * Time.deltaTime;
PlayerBody.Rotate(Vector3.up * mouseX);
The camera is the only one which needs to rotate up in the vertical axis, so it doesn't matter for the Y rotation. I tried to just make the camera replicate the rotation and position of the body, but the code was just too clunky. Any tips? Again, I am pretty new so this might have the silliest answer. Thanks in advance!
Your answer
Follow this Question
Related Questions
Rotation around player. and Camera position, 2 Answers
Fix rotation skipping 0 Answers
How to disable mouse look in Unity 5? 2 Answers
Problems with rotating the player on the Y axis C# 0 Answers
How can I stop my first person camera from going upside down? 0 Answers