[SOLVED] How to achieve smooth camera rotation?

Hello, let’s say there is a camera object (as a child) under the Player object, and naturally the camera automatically follows wherever the player goes or turns. However, when the player suddenly turns 180 degrees to the right or left, the camera turns very hard with the player. How can I soften the rotation of this camera? Can you leave a sample code block?

I looked at the Tween library but didn’t understand much.

Ekran Alıntısı

Hi @Onur_Ozturk,

You can use vector lerp to smoothly interpolate between two positions or two rotations. Here is some example code:

1 Like

Thank you, I will try right away

If the camera is always the child of the object that it is following, then there is no easy way to really add damping there as any changes to the rotation of the object directly affects the camera.

You would want the camera to be an entity that isn’t a child of it and have logic to follow it.

We have an example here: Vehicle Physics | Learn PlayCanvas

In the project, there is a script called ‘follow-camera.js’ that has common logic for this type of thing.

1 Like

Thank you for your answer. I will review the project. Thank you again