using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Mouselook : MonoBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerbody;
public xrotation = 0f;
// Start is called before the first frame update
void Start()
{
Cursor.lockstate = CursorLockMode.Locked;
}
// Update is called once per frame
void Update()
{
float mousex = Input.GetAxis(“Mouse X”) * mouseSensitivity * Time.deltaTime;
float mousey = Input.GetAxis(“Mouse Y”) * mouseSensitivity * Time.deltaTime;
xrotation -= mousey;
xrotation = Mathf.Clamp(xrotation, -90f, 90f);
transform.localrotation = Quaternion.Euler(xrotation, 0f, 0f);
playerbody.Rotate(Vector3.up * mousex);
I was looking everywhere and nothing seemed to help. I would appreciate any help, thx.