I have two points, one is moving and one is stationary. I would like to know if the moving point has reached that point or not. I tried to calculate the distance between two vectors and the distance never reaches 0.
You have one of these problems:
Solution is not to treat points as points, but as physical objects, giving them some size, e.g. spheres. You could assume a point is a sphere of 1 pixel diameter (0.5 px radius), it would mean you need to check if distance is < .5+.5 that is
The reason why this is not working is because of your understanding of the problem. You are considering the two objects to be two points. In games the position of an object in world space is most commonly a vector quantity.
Instead you should consider these two "points" as vectors. Next you can follow a few simple steps to arrive at a solution.
The pseudocode for this would be as such:
I hope this helps.
Check if the two points are close enough.
Lets say the speed of point A (moving point) is
If A is moving towards B (stationary point) and is currently in a distance smaller than
You need to check if the distance between the moving point and the stationary point is less than the size of one step for the moving point.
If that happens the moving point will reach the stationary point in the next frame.
If this never happens, it means that point A is not moving towards point B or that it is moving in a speed so slow that it will not allow it to reach point B in a finite time such (C/n^2) where n is the current frame index and C is a constant.