using UnityEngine; using UnityEngine.InputSystem; public class movement : MonoBehaviour { public float sensX; public float sensY; public Transform BodyOrientation; float xRotation; float yRotation; void Start() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } void Update() { // get raw mouse delta from the new Input System Vector2 mouseDelta = Mouse.current.delta.ReadValue(); float mouseX = mouseDelta.y * Time.deltaTime * sensX; xRotation -= mouseX; float mouseY = mouseDelta.x * Time.deltaTime * sensY; yRotation += mouseY; // clamp so you can't flip the camera upside down xRotation = Mathf.Clamp(xRotation, -90f, 90f); // apply rotation transform.rotation = Quaternion.Euler(xRotation, yRotation, 0); BodyOrientation.rotation = Quaternion.Euler(0, yRotation, 0); } }