You should never compare a floating point value to another value using ==
. There are likely very minor floating point differences between the numbers that will prevent them from being exactly equal. Instead, you need to compare that they are within some small tolerance of being the same.
You can either do that yourself or use the in-built:
is_equal_approx ( float a, float b )
So, in your case:
if is_equal_approx(global_position.distance_to(point), 0):