Camera2D: Signal for stoping smothely

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

Hi,

is there a signal to check if the camera reaches the destination if the smooth movement mode is activated? If I change the camera Focus point, the cam needs some time to reach the destination…

:bust_in_silhouette: Reply From: bogdan000

I don’t think so, but you can use code to check for that.

Code for parent:

var camera = $Camera2D
func _physics_process(delta):
    if $Camera2D.global_position.distance_to(global_position) < 1.0:
        #enter code here
        pass

The reason for the “< 1.0” is that Camera2D uses linear interpolation for smoothing its movement. The farther away its target is, the faster it will follow. This means that it will follow very slowly when it is near and it will reach its destination very slowly, if at all.

But if we use the “< 1.0” then we’re forgiving it a bit for the sake of it working.