# Intercepting an object moving in R^3 with a projectile that has constant acceleration

1. Oct 7, 2012

### QuaternionKid

1. The problem statement, all variables and given/known data

Find $\vec{v}_{P}$ (initial velocity) for a projectile with an arbitrary$\left\|\vec{v}_{P}\right\|$ (fixed initial speed), constant acceleration $\vec{a}_{P}$, and starting position $\vec{p}_P$ so that it will intercept an object whose movement is described by the equation $T(t) =\vec{v}_{T}\cdot t + \vec{p}_{T}$.

All vectors are elements of $R^{3}$.

2. Relevant equations

Position of projectile:

$P(t) = \frac{1}{2} \cdot \vec {a}_{P} \cdot {t}^{2} + \vec {v}_{P} \cdot t + \vec {p}_{P}$

Position of target object:

$T(t) =\vec{v}_{T}\cdot t + \vec{p}_{T}$.

Unknowns:

$\vec{v}_{P}$ (Projectile velocity)

Knowns:

$\left\|\vec{v}_{P}\right\|$ (Projectile speed)

$\vec{a}_{P}$ (Projectile acceleration)

$\vec{v}_{T}$ (Target velocity)

$\vec{p}_{P,T}$ (Both Projectile and Target initial positions)

For a general solution, the projectile's acceleration would be $<{a}_{x}, {a}_{y}, {a}_{z}>$, but I've been letting it be $<0, 0, -9.8m/{s}^{2}>$ for my own convenience.

3. The attempt at a solution
I'm trying to give the AI of a video game I'm making the ability to "lead" moving targets with arrows which experience gravity drop. The arrows always come out at the same initial speed, so I need to solve for the direction in which to shoot them in order for them to hit a moving target.

I've solved the problem for projectiles which have a constant velocity by letting $\left\| \vec{v}_{T}\cdot t + \vec{p}_{T} \right\| = \left\|{v}_{P}\right\| \cdot t + \left\|\vec{p}_{P}\right\|$, simplifying, then finding the time of interception using the quadratic equation. You can basically just plug the time of interception into the target's position function to get the direction vector you have to aim in to score a hit.

I don't know how to set up the solution for projectiles which have acceleration (gravity drop) though. So far I've tried to solve for each of the components individually, but that leads me to a place from where I don't know how to continue.

Last edited: Oct 7, 2012
2. Oct 7, 2012

### AJKing

Re: Intercepting an object moving in R^3 with a projectile that has constant accelera

Woo! My kind of question.

First, I'm not sure what you're asking, exactly, so I've answered with what I would do. I hope this helps, tell me if it doesn't.

So, I'm understanding that you have a flying object dropping some kind of bomb on a walking object.

Both of these objects move with constant velocity; that velocity is variable.

I'm also assuming that the ground is parallel to the motion of flight; if it's not, then this needs more work.

No matter what, we have to start by finding out how long it's going to take for the bomb to hit the ground, and I don't believe yours is the most efficient way. Once we find that time, then we can determine how far the target moves in that time and thus designate out $\vec{v}_x$ and $\vec{v}_z$ to garuntee collision.

But first, time.

Under constant acceleration, we may use:

$y_f = y_o + \frac{1}{2}(v_{yo} + v_{yf}) * t$

Where $t$ = time for the object to hit the ground
$(y_f - y_o)$ = the total height the object falls
$\frac{1}{2}(v_{yo} + v_{yf})$ = average velocity of the fall under constant acceleration (remember that change in velocity is linear under constant acceleration, making averages as acurate as anything).

$t = \frac{(y_f - y_o) * 2}{v_{yo} + v_{yf}}$

This is nice, but $v_{yf}$ needs help.

we can use the following to keep the variables simple.

$v_{yf}^2 = v_{yo}^2 + 2a(y_f - y_o)$

$v_{yf} = \sqrt{v_{yo}^2 + 2a(y_f - y_o)}$

thus, the time that it will take for the bomb to reach the ground, given its initial velocity, height and acceleration under gravity is:

$t = \frac{(y_f - y_o) * 2}{v_{yo} +\sqrt{v_{yo}^2 + 2a(y_f - y_o)}}$

This means you can shoot the bomb down how ever fast you like and still find out how long it will take.

If we ignore movement in the y direct, for the sake example, then all we need to do now is solve for the x and z components of the bombs' velocity such that they will be over the target at time t.

This also means that we'll need to know where the target will have moved in time t, given it's initial velocity in the x and z direction, shall we work that out aswell?

3. Oct 7, 2012

### QuaternionKid

Re: Intercepting an object moving in R^3 with a projectile that has constant accelera

Only the target will be moving with a constant velocity, however. I probably wasn't clear enough in my statement of the problem. The projectile itself will have a fixed initial speed, but will undergo constant acceleration.

An example situation closer to what I'm going for would be a hunter with a bow and arrow trying to shoot a bird that is mid-flight, assuming the bird is flying at a constant velocity. When the hunter shoots his arrow, the arrow's initial speed must be set to, say, 30 m/s. However, during its flight towards the bird, gravity will pull down on the arrow and will reduce the z component of its velocity. I would need to find $\vec {v}_{i}$ for the arrow so that its $\left\|\vec {v}_{i}\right\| = 30 m/s$ and so that it will also hit the bird, who is moving.

4. Oct 7, 2012

### AJKing

Re: Intercepting an object moving in R^3 with a projectile that has constant accelera

I see.

My equation does solve for the case of vertical acceleration, but I was confused on the initial conditions that you're looking to solve in, can you please describe that?

Is it the hunter scenario?

5. Oct 7, 2012

### QuaternionKid

Re: Intercepting an object moving in R^3 with a projectile that has constant accelera

Sure, sorry for the confusion. Yes, the hunter scenario best describes what I'm aiming for. I've edited the original post to make it clearer to anyone else who sees it.

Here are the equations governing the motions of the projectile and the target, and below those, the unknown and known variables.

Position of projectile:

$P(t) = \frac{1}{2} \cdot \vec {a}_{P} \cdot {t}^{2} + \vec {v}_{P} \cdot t + \vec {p}_{P}$

Position of target object:

$T(t) =\vec{v}_{T}\cdot t + \vec{p}_{T}$.

Unknowns:

$\vec{v}_{P}$ (Projectile velocity)

Knowns:

$\left\|\vec{v}_{P}\right\|$ (Projectile speed)

$\vec{a}_{P}$ (Projectile acceleration)

$\vec{v}_{T}$ (Target velocity)

$\vec{p}_{P,T}$ (Both Projectile and Target initial positions)