Smooth camara 2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BigBackPack

I have a 2D topdown game where my player is moving during turns away from the cam, but in the end of every turn the cam is focusing back on the player. However the movement of the cam while getting back to the player is very snappy - it just jumps from one position to the other. To make the transition smooth i tried this code inside of _process (delta):
$Camera2D.position = lerp($Camera2D.position, $player.position, 0.9)

but still the movement is just snapping from one position to the players position without any transition. I am quiet new to godot and programming in general … any suggestions?

Thx

:bust_in_silhouette: Reply From: The_Black_Chess_King

There is a built-in option just for that.

Under the inspector of a camera2D you can find Smoothing.

enter image description here

thx a lot! that helped :slight_smile:

BigBackPack | 2020-05-14 20:43