6
\$\begingroup\$

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.)

\$\endgroup\$

2 Answers 2

10
\$\begingroup\$

Let x be the position of the target relative to us, and let v be our (the projectile's) velocity relative to the target. The speed ||v|| of the projectile and the acceleration vector a are constant. We set up the usual equation of motion:

Final equation of derivation: 0 = x.x - (x.a + ||v||^2)*t^2 + a.a * t^4 / 4

This is now simply a biquadratic equation, which we can solve for t^2 with the usual quadratic formula, and take the square root again to get t:

t=sqrt((x.a+||v||^2 +- sqrt((x.a + ||v||^2)^2 - (a.a)(x.x))/((a.a)/2))

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 v=x/t-1/2 * a * t 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.

\$\endgroup\$
1
0
\$\begingroup\$

If you are only interested in calculating a launch angle assuming you have a turret that rotates through an azimuth in the horizontal plane and elevates its barrel at angle theta, there is another equation you can use. Assume you have a coordinate system where x points North, y points vertically, and z points East. Assume the turret is at the origin and the target is at (x0,y0,z0). The target is stationary and the projectile speed is v. The angle is calculated using the equation below:

Launch Angle Formula

where C = x02 + z02 and D = g(x02 + z02)/(2v2)

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .