Main camera rotation to follow player movements

Hello!
I am building a 2d game with a top-down view.
I made the camera follow the player’s rotation but the result is clearly jerky.

This is the code that I used first :
scene.cameras.main.setRotation(player.rotation)

Then I limited the speed of the camera to 0.001 rad per frame (75Hz) and the result is smooth but the camera take a lot of time to catch up to the player.

I wonder if there is a way to make camera rotation smooth while maintaining a speed around 0.015 rad/frame (0.9 degrees)?

On a different level, I guess that FPS use motion blur to make you feel that the result is smooth.

How did you limit the speed of the camera?

You can do

camera.rotation = Phaser.Math.Angle.RotateTo(
  camera.rotation,
  player.rotation,
  0.015
);
1 Like