# Hard projectile physics question

Luke
I'm asking if you know the equation to hit a moving target with a projectile.

the canon, or where the projectile is launched from is 0,0
the target is at d,0
the target is moving away at a speed of vx2,0
Note: the target is always going to be at ground level, 0, and only has a constant x speed.
the canon it pointing at an angle of a
the question now, is to solve for the power of the cannon, v.
y = projectile y value
vy1 = y velocity of projectile
basic projectile physics:
y = vy1*t - (1/2)*g*t^2
so when y is the height of the target:
0 = vy1*t - (1/2)*g*t^2 so...
vy1*t = (1/2)*g*t^2 and...
vy1 = g*t/2 so that is the y velocity the projectile need to be launched at in order to land in time t.

since time is distance over rate, the time of collision is t = d/(vx1 - vx2)

so time of collision with ground need to equal time of collision with target.
So substitute t = d/(vx1 - vx2) with vy1 = g*t/2
and you get:
vy1 = g*d/(2*(vx1 - vx2))
Note: if vx1=vx2 then vx1-vx2=0 and then the denominator is zero, so they would never collide.
And we can find the launch speed and angle of the projectile:
vx1=v*cos(a)
vy1=v*sin(a)
v=sqrt(vx1^2 + vy1^2)
so
v*sin(a) = g*d/(2*(v*cos(a) - vx2))
so v = g*d/(2*(v*cos(a) - vx2))/sin(a)

but there is still a v on the right, could someone help me here in solving for v?

Last edited by a moderator: