[Math Question] Projectile Calculation

Last edited on
Off the top of my head:

Define:

T be the target's current position (known)
T_s target's speed vector (known)
P shooter's position (known)
B_s speed vector of the bullet (unknown)
|B_s|=s the speed of the bullet (known)
t time taken for bullet to hit target (unknown)

We want to hit the target assuming they keep the same speed vector, so:

T+T_s*t = P + B_s * t

Rearrange and take length of both sides

|T+T_s*t-P| = |B_s|t
|T+T_s*t-P| = s*t

Square both sides and do some significant tidying up (when I write vector squared I mean dot product with self)

t^2(|T_s|^2-s^2) + t(2T_s.(T-P)) + (T-P)^2 = 0

I would double check that though, I've just scribbled it down and could have made a mistake.

This leaves you a quadratic equation for t which you can then solve.

Once you know t, substitute it into the first equation to find B_s

(T+T_s*t - P)/t = B_s
Topic archived. No new replies allowed.