public class CameraRotation : MonoBehaviour { public float sensetivity = 10f; public float AngleY = 80f; private float rotationX = 0f; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { float MouseX = Input.GetAxis("Mouse X"); float MouseY = Input.GetAxis("Mouse Y"); transform.parent.Rotate(Vector3.up * MouseX * sensetivity); rotationX -= MouseY * sensetivity; rotationX = Mathf.Clamp(rotationX, -AngleY, AngleY); transform.localRotation = Quaternion.Euler(rotationX, 0.0f, 0.0f); } }