Fps Camera rotation very choppy and jittery

I’m extremely new to unity, and I’m trying to make a simple character controller with a rigidbody, but my camera movement is so extremely laggy.

void Look()
    {
        //Gets the mouse input and multiplies it by the sensitivity
        float horizontal = Input.GetAxis("Mouse X") * sensitivity;
        float vertical = Input.GetAxis("Mouse Y") * sensitivity;

        //Variable which keeps track of the rotation of the camera on the y
        yClamp += vertical;

        //Rotates the camera and player
        camera.transform.Rotate(-Vector3.right * vertical);
        transform.Rotate(Vector3.up * horizontal);

        //Prevents the camera from rotating upside down
        if(yClamp >= 90)
        {
            Clamp(camera.transform, 270, "x");
            vertical = 0;
            yClamp = 90;
        }
        else if (yClamp <= -90)
        {
            Clamp(camera.transform, 90, "x");
            vertical = 0;
            yClamp = -90;
        }
    }

    //Clamps the rotation of a given transform on the given axis by the given number
    void Clamp(Transform obj, float value, string axis)
    {
        Vector3 eulerAngles = obj.eulerAngles;

        switch (axis)
        {
            case "x":
                eulerAngles.x = value;
                break;

            case "y":
                eulerAngles.y = value;
                break;
        }

        obj.eulerAngles = eulerAngles;
    }

Any help is appreciated, thanks in advance.

Updating camera movement should be done in LateUpdate().

_

_
“LateUpdate is called after all Update functions have been called. This is useful to order script execution. For example a follow camera should always be implemented in LateUpdate because it tracks objects that might have moved inside Update.

Hey, would you mind sharing the code that you used to rotate the camera for your game? :slight_smile:

@unity_Vpi53N_fb99F6g