Moving player using cam.ScreenToWorldPoint, with camera smooth following the player

Hello,

In my game, I use the deltaTouch to move my player.

And the camera smooth follow the player.

I do that like this :

deltaPosition = cam.ScreenToWorldPoint(new Vector3(gesture.position.x, 0, zDist)) - startPosition
                               - (cam.transform.position - startCameraPosition);


player.position += Vector3.right * deltaPosition.x;

and for the camera :

 transform.position = new Vector3(Mathf.Lerp(transform.position.x, player.position.x, speed * Time.deltaTime), transform.position.y, target.position.z + z);

It works fine, it’s perfect. BUT : The player is glitching/vibrating a little bit.

It’s at 100% because of the positioning of the player depends of the camera position, and the camera position depends of the player…

I have no idea how to handle this visual issue.

Thanks a lot for your helps.

Best regards,

AB

Is the camera transform inside LateUpdate?