PDA

View Full Version : Interception angle


thomasvt
Feb10-10, 05:49 AM
Hey,

I like writing puzzle games, and normally i solve my physics programming challenges on my own, but this problem i have now reveiled itself to be quite a tough one. Even after involving my smarter friends :) Probably plain easy for motion physics adepts, but i forgot most of my fysics and goniometrics i learned in school, except for the things i use in physics programming all the time.. so i need a bit of help :)

view:
from above, like looking at a road-map

objects:
A = static canontower
- shoots bullets (no friction, gravity) at v = constant (eg 600m/s)
- can turn around its pivot so can shoot the bullet in any desired direction
B = an enemy
- moves at v = constant (eg 200m/s) at some direction (so it has a 2D velocity vector)

question (if you didn't guess it by now)
* what angle should BĀC be so that the bullet intercepts enemy B at unknown point C


******(enemy)*******
**********B-->*-*-*-*-*C*(interception*point)
***********\**************/
************\************/
*************\**********/
*************\*********/
**************\*******/
***************\*****/
***************\****/
****************\**/
******************A*(tower*-*startposition*of*bullet)





I already fixed this problem, but i doubt my solution to be correct:
s = vt ==> s/v = t
==>
|BC| / vb = t = |AC| / va (vb = enemy speed, va = bulletspeed)
hence: |BC| = |AC| * vb / va (for instance)

And also that the "sinus rule" (literaly translated from Dutch) will probably lead me to calculating the BĀC angle. With sinus rule i mean: sin A / |BC| = sin B / |AC| = sin C / |AB| (or something like that)

Using this "sinus rule" i come to:
sin A = sin B / |AC| * |BC|
and using my former |BC| formula, i get:
sin A = sin B / |AC| * (|AC| * vb / va)
=>
sin A = sin B * vb * va
and since vb and va are known, and sin B easily calculated, i should have a solution..

but my guts tell me it can't be this easy (i expect a quadratic function because it involves intersection of 2 circles, i believe) and besides, my result doesn't need input from the distance between tower and enemy, which is obviously influencing the whole thing...

so, any solutions from you, please?

thank you very much

thomasvt
Feb10-10, 05:54 AM
the drawing is a bit messed up, but i think the triangle i meant to show is clear enough

Jonny6001
Feb18-10, 01:56 PM
How about using parametric equations to work out the position of a point along a line at time 't', do this for both the bullet and enemy, then make the 'x' or 'y' components of each vector equal then solve for 't'.

You can then work out the angle from the length AC.

thomasvt
Feb19-10, 06:31 AM
Hi Johnny,

because my question remained unanswered for quite a while, I already found a method for solving this problem. And it is exactly as you summarize.

In the meantime though, I found out that my problem is a bit more complex, you still need to rotate the cannon to that angle, which takes time too. So by the time you get there, the situation has changed again.

But, by now I already have resolved my entire problem, so no more question marks left :)

thanks for the answer !