1. ## Target Interception

Hello,

it's been a while since I did any real math so I'm having a bit of a hard time with what should be a simple problem. I need to find an equation for intercepting a target (Item A) that's moving at a constant speed by throwing Item B at it from a fixed point. What I'm really interested in the angle at which I should throw Item B. (this is for a video game I'm making by the way)

I know the speed of Item A, I know the distance between Item A and B and I know that Item B will be thrown at a constant speed... I just need to figure out the angle (or the components x and y).

The way I went about it was by saying that the distance travelled by Item A at the moment of impact is:

Xa = Vax * t (Xa being the distance travelled and Vax its speed in x)

and the angle of Item B is :

cos th = adj / hip = Yb / (Vb * t)

substituting t we get :

Xa = Vax * Yb / (Vb * cos th)

Knowing that the distance in X between A and B is Xt = Xa + Xb :

Xt - Xb = Vax * Yb / (Vb * cos th)
Xt - Yb * tan th = Vax * Yb / (Vb * cos th)

Which finally gives :

Xt * cos th - Yb * sin th = Vax * Yb / Vb

The only thing unknown in this equation is the angle th... any help on how I could solve this, and eventually any corrections on the procedure?

Thanks,
i

2. Hello mansiva

Welcome to Math Help Forum!
Originally Posted by mansiva
Hello,

it's been a while since I did any real math so I'm having a bit of a hard time with what should be a simple problem. I need to find an equation for intercepting a target (Item A) that's moving at a constant speed by throwing Item B at it from a fixed point. What I'm really interested in the angle at which I should throw Item B. (this is for a video game I'm making by the way)

I know the speed of Item A, I know the distance between Item A and B and I know that Item B will be thrown at a constant speed... I just need to figure out the angle (or the components x and y).

The way I went about it was by saying that the distance travelled by Item A at the moment of impact is:

Xa = Vax * t (Xa being the distance travelled and Vax its speed in x)

and the angle of Item B is :

cos th = adj / hip = Yb / (Vb * t)

substituting t we get :

Xa = Vax * Yb / (Vb * cos th)

Knowing that the distance in X between A and B is Xt = Xa + Xb :

Xt - Xb = Vax * Yb / (Vb * cos th)
Xt - Yb * tan th = Vax * Yb / (Vb * cos th)

Which finally gives :

Xt * cos th - Yb * sin th = Vax * Yb / Vb

The only thing unknown in this equation is the angle th... any help on how I could solve this, and eventually any corrections on the procedure?

Thanks,
i
I can't really comment on the accuracy of your working, since you don't explain clearly enough the initial conditions. For example, I can't see why you have $x_t = x_a + x_b$. However, I can explain how to solve an equation like the one you've ended up with, and it's this:

Let $x_t\cos\theta - y_b\sin\theta = r \cos(\theta+\alpha)$
$=r\cos\theta\cos\alpha -r\sin\theta\sin\alpha$
$\Rightarrow \left\{\begin{array}{l }r\cos\alpha=x_t\\r\sin\alpha=y_b\end{array} \right.$

$r^2=x_t^2+y_b^2$
$\tan\alpha = \frac{y_b}{x_t}$
So, with these values of $r$ and $\alpha$, you now solve:
$r\cos(\theta - \alpha) =\frac{v_{ax}y_b}{v_b}$
$\theta=\arccos\left(\frac{v_{ax}y_b}{v_b\sqrt{x_t^ 2+y_b^2}}\right)+\arctan\left(\frac{y_b}{x_t}\righ t)$