I was following Brackey’s first person movement tutorial and copied his code but mine does something different, it flips the character by 90 y axis.
Brackeys video
What happens when starting the game:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour
{
public float sensitivity = 100f;
public Transform playerBody;
private float xRotation = 0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
float mouseX = Input.GetAxis("Mouse X") * Time.deltaTime * sensitivity;
float mouseY = Input.GetAxis("Mouse Y") * Time.deltaTime * sensitivity;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
playerBody.Rotate(Vector3.up * mouseX);
}
