How do I aim a constant speed projectile to hit a target if there is a constant acceleration vector acting on it? (For example, the wind and gravity from Worms.)
Let be the position of the target relative to us, and let be our (the projectile's) velocity relative to the target. The speed of the projectile and the acceleration vector are constant. We set up the usual equation of motion:
The lesser and greater positive real roots are the minimum (shallowest) and maximum (steepest) flight times of the projectile, respectively. Both of these will exist if there is any solution. We can then just plug them back into to recover the actual velocity vector. We're normally looking for the minimum flight time solution, but if e.g. there's a hill in the way, the maximum time solution might be able to shoot over it.