- #1
thomasvt
- 7
- 0
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
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
Last edited: