I don’t get why I cant look sideways? I can look up and down fine though. the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour
{
public float mouseSensetivity = 100f;
public Transform playerbody;
float xRotation = 0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
float mouseX = Input.GetAxis("Mouse X") * mouseSensetivity * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * mouseSensetivity * Time.deltaTime;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
playerbody.Rotate(Vector3.up * mouseX);
}
}