Get Projectile hit moving target

  • Context: Undergrad 
  • Thread starter Thread starter calthabis
  • Start date Start date
  • Tags Tags
    Projectile
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 7K views
calthabis
Messages
3
Reaction score
0
Hello i need this för a coding project I am currently occupying myself with =)

ok so the system is in a 2D space, the projectile starts at a height H and is supossed to hit target T. the targets y.coord is constant Ty but his x has a speed Tv towards the projectiles start. the target starts at a distance D from the projectile. the projectile has a given starting speed of Pv0 and the angle A.

oh right and gravity is affecting the projectile =)SO! what i need is a formula that can tell what angle I need to hit the target.

Thanks in advance
 
Last edited:
Physics news on Phys.org
Was this too difficult or is there not enough information??
:confused:
 
You can write an expression for the location of the projectile as a function of t and the angle, and you can write an expression for the location of the target as a function of t. Set them equal to each other and you have an equation describing when they collide. That leaves 2 equations in 2 unknowns so you can solve for t and the angle.
 
This is how far I've got. I am stuck so can you please say how i can solve the rest or if there is some other way to solve it.
it might be quite hard to follow on screen so i suggest you follow my calculations on paper.

the target's y coordinate is always 0

Tv = the target's X velocity (speed)
Pv = the projectile's velocity

d0 = the target's x coordinate at t=0
y0 = the projectile's y coordinate at t=0


Pvx = Pv * cosa
Pvy = Pv * sina +gt

Px = Pv *cosa *t
Tx = d0 + Tv *t
Py = y0 + Pv* sina + (g*t^2) / 2
Ty = 0


Tx = Px
Ty = Py


(1.) d0 + Tv *t = Pv *cosa *t
(2.) 0 = y0 + Pv* sina + (g*t^2) / 2


(1.) cosa^2 = ( ( d0 + Tv *t )/(Pv * t) )^2
(2.) sina^2 = (( -y0 -(g*t^2) / 2 ) / Pv)^2


cosa^2 + sina^2 = 1
(1.) + (2.) = 1

( ( d0 + Tv *t )/(Pv * t) )^2 + (( -y0 -(g*t^2) / 2 ) / Pv)^2 = 1
 
You shouldn't try to solve this by hand. You should either plug the equations into a symbolic math package, like Mathematica, or you should solve it numerically. Just for grins I used Mathematica. I had these two equations describing repectively the x and y coordinates of the collision:

T0x + t Tvx == Pv t Cos[a]
2 P0y + g t^2 + 2 Pv t Sin[a] == 0

Solving this simple appearing system for t and a resulted in 8 roots, each one of which was over 100 pages of output.

You could probably solve this a more clever way to get fewer roots and slightly simpler expressions. One typical way is to not solve for the angle but rather the x and y components. But you would never get something truly simple. If you are coding I would recommend using a numerical solver. There are lots of packages available, many for free.
 
Last edited: