Quaternion.euler gives me glitch. Why?


I’m trying to make a FPS controller movement and i spend like all day to fix this problem but can’t find an answer, so if anyone can help me with some links or ideas for fixing, i will be grateful

This is my code with the problem:

  mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime; 
  mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;    
        xRotation = -mouseY;
        var euler = new Vector3(xRotation, 0, 0);
        transform.rotation = Quaternion.Euler(euler.x, euler.y, euler.z);

first of, mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;returns a small value.
secondly, var euler = new Vector3(xRotation, 0, 0); creates a quaternion with x being this small value,
then you set your rotation to that.

do mouseY += instead. and don’t forget to clamp it