- Home /
Smooth Camera 2D
Hi, I had some problem with this script. When the speed of the Player is higher than the camera's speed, then there is a bad effect. Is like the camera tremble up and down at high speed. How can i solve it?
Vector3 point = camera.WorldToViewportPoint(target.position);
Vector3 delta = target.position - camera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, point.z));
Vector3 destination = transform.position + delta;
transform.position = Vector3.SmoothDamp(transform.position, destination, ref velocity, dampTime);
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613162249im_/https://answers.unity.com/themes/thub/images/avi.jpg)