For a 2D game I'm working on, I'd like to figure out when a projectile reaches its closest to point to its target.
A projectile is a point that moves by a constant dx,dy per frame. A target is another point whose speed relative to the projectile is slow enough as to be considered stationary. I want to have the projectile explode when it is (approximately) as close to the target as it will be.
What's a good way to calculate this?
Absolute precision is not critical, this is the client-side simulation of an event that has already been resolved on the server. I'd prefer an algorithm that was fast and simple to one that was pixel perfect.