My player's camera displays jerky objects

Hello ! I am in an unity fps project so I create a script to move my player and to move the camera but the problem is when I move my player and the camera at the same time looking at an object. The object is jerky … (https://youtu.be/qQ1G3LH0aS4)

**

PlayerController :

**

using UnityEngine;
 
[RequireComponent(typeof(Rigidbody))]
public class PlayerController : MonoBehaviour
{
    private Rigidbody rb;
    public LayerMask layerMask;
 
    public bool Grounded;
 
    public float speed = 6;
    public float speedBoost = 5;
    public float JumpForce = 4;
 
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }
 
    void FixedUpdate()
    {
        //Input
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
 
        //Moving
        Vector3 direction = new Vector3(x, 0, z);
        rb.MovePosition(rb.position + transform.TransformDirection(direction) * speed * Time.fixedDeltaTime);
        if (direction.sqrMagnitude > 1)
            direction.Normalize();
        //transform.Translate(direction * speed * Time.fixedDeltaTime);
        //rb.AddForce(direction * speed * Time.fixedDeltaTime);
 
        //Grounding
        Grounded = Physics.CheckSphere(new Vector3(transform.position.x, transform.position.y - 1, transform.position.z), 0.4f, layerMask);
 
        //Jumping
        if (Input.GetKeyDown(KeyCode.Space) && Grounded)
        {
            rb.velocity = new Vector3(rb.velocity.x, JumpForce, rb.velocity.z);
        }
 
        //Sprinting
        if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            speed += speedBoost;
        }
        else if (Input.GetKeyUp(KeyCode.LeftShift))
        {
            speed -= speedBoost;
        }
    }
}

**

PlayerLook :

**

using UnityEngine;
 
public class PlayerLook : MonoBehaviour
{
    public Transform player;
 
    public float mouseSensitivity = 4;
    private float x = 0;
    private float y = 0;
 
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
    }
 
    void Update()
    {
        //Input
        x += -Input.GetAxis("Mouse Y") * mouseSensitivity;
        y += Input.GetAxis("Mouse X") * mouseSensitivity;
 
        //Clamping
        x = Mathf.Clamp(x, -90, 90);
 
        //Rotation
        transform.localRotation = Quaternion.Euler(x, 0, 0);
        player.transform.localRotation = Quaternion.Euler(0, y, 0);
    }
}

Try this code @ZeyFight , I just changed to MoveTowards to make the rotation smoother.

public Transform player;
    public float lookSpeed = 10f;

    public float mouseSensitivity = 4;
    private float x = 0;
    private float y = 0;

    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
    }

    void Update()
    {
        //Input
        x += -Input.GetAxis("Mouse Y") * mouseSensitivity;
        y += Input.GetAxis("Mouse X") * mouseSensitivity;

        //Clamping
        x = Mathf.Clamp(x, -90, 90);

        //Rotation
        transform.localRotation = Quaternion.Euler(Vector3.MoveTowards(transform.localRotation.eulerAngles, new Vector3(x, 0, 0), lookSpeed * Time.deltaTime));
         player.transform.localRotation = Quaternion.Euler(0, y, 0);
    }

Makes mouse look as smooth as silk.
_

note: this code won’t help with ugly jitter coming from controller movement. It is there 100% because a camera being parented to a Rigidbody is sure way to produce it. And the lower the framerate the more visible it becomes.
_

using UnityEngine;

public class PlayerLook : MonoBehaviour
{
	[SerializeField] Transform _player;
	[SerializeField] float _mouseSensitivity = 100f;
	[SerializeField][Min(1f/50f)] float _mouseInterpolationTime = 0.1f;
	( float horizontal , float vertical ) _mouse, _mouseDir, _mouseInterpolated, _angle;

	void Start ()
	{
		Cursor.lockState = CursorLockMode.Locked;
	}

	void Update ()
	{
		_mouse = ( horizontal: Input.GetAxisRaw("Mouse X") , vertical: Input.GetAxisRaw("Mouse Y") );
		
		if( _mouse.horizontal<0 ) _mouseDir.horizontal = -1;
		if( _mouse.horizontal>0 ) _mouseDir.horizontal = 1;
		if( _mouse.vertical<0 ) _mouseDir.vertical = -1;
		if( _mouse.vertical>0 ) _mouseDir.vertical = 1;
		// note: don't replace this with Mathf.Sign as 0 must stay ignored
	}

	void FixedUpdate ()
	{
		float deltaTime = Time.fixedDeltaTime;

		// look left-right
		if( Mathf.Sign(_mouseInterpolated.horizontal)==_mouseDir.horizontal )
		{
			_mouseInterpolated.horizontal = Mathf.Lerp(
				_mouseInterpolated.horizontal ,
				_mouse.horizontal * _mouseSensitivity ,
				(1f/_mouseInterpolationTime) * deltaTime
			);
		}
		else
		{
			_mouseInterpolated.horizontal = _mouse.horizontal;
		}
		_angle.horizontal += _mouseInterpolated.horizontal * deltaTime;
		_player.localRotation = Quaternion.Euler( 0 , _angle.horizontal , 0 );

		// look up-down
		if( Mathf.Sign(_mouseInterpolated.vertical)==_mouseDir.vertical )
		{
			_mouseInterpolated.vertical = Mathf.Lerp(
				_mouseInterpolated.vertical ,
				_mouse.vertical * _mouseSensitivity ,
				(1f/_mouseInterpolationTime) * deltaTime
			);
		}
		else
		{
			_mouseInterpolated.vertical = _mouse.vertical;
		}
		_angle.vertical = Mathf.Clamp( _angle.vertical - _mouseInterpolated.vertical * deltaTime , -90f , 90f );
		transform.localRotation = Quaternion.Euler( _angle.vertical , 0 , 0 );
	}

}