Camera shaking problem

Hi everyone, I am quite new in programming so I followed a YouTube tutorial on how to make the camera follow the player. Unfortunately my camera sometimes randomly starts to shake a bit, especially when the player is near bounds or colliders. Does any of you has an idea on how to fix this problem? Thanks in advance!

` public Transform lookAt;
    public Vector3 offset = new Vector3(0, 5.0f, -10.0f);

    
    void Start()
    {
        transform.position = lookAt.position + offset;
    }

    private void LateUpdate()
    {
        Vector3 desiredPosition = lookAt.position + offset;
        transform.position = lookAt.position + offset;
        desiredPosition.x = 0;
        transform.position = Vector3.Lerp(transform.position, desiredPosition, Time.deltaTime);
    }
}`

Hello @arvidowic,
You can try to smooth the movement, I do it like this personally:
public Transform lookAt;
public Vector3 offset = new Vector3(0, 5.0f, -10.0f);

    void Start()
    {
        transform.position = lookAt.position + offset;
    }

    Vector3 desiredPosition;
    float smoothAmount = 0.7f;

    private void LateUpdate()
    {
         desiredPosition = Vector3.Lerp(lookAt.position + offset, desiredPosition, smoothAmount);
        transform.position = lookAt.position + offset;
        desiredPosition.x = 0;
        transform.position = Vector3.Lerp(transform.position, desiredPosition, Time.deltaTime);
    }

However you can trigger the movement only when distance is greater than a number like this:
public Transform lookAt;
public Vector3 offset = new Vector3(0, 5.0f, -10.0f);

    void Start()
    {
        transform.position = lookAt.position + offset;
    }

    float minDistance = 2;

    private void LateUpdate()
    {
        Vector3 desiredPosition = lookAt.position + offset;
        transform.position = lookAt.position + offset;
        desiredPosition.x = 0;

        if (Vector3.Distance(desiredPosition, lookAt.position)>minDistance)
            transform.position = Vector3.Lerp(transform.position, desiredPosition, Time.deltaTime);
    }

I hope it will help you.