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