solving for an intercept in 3d.

sparkzbarca

New member
Joined
Jul 18, 2013
Messages
2
ok so this is for a computer program.

I have the general idea of how to solve for one my issue is the whole moving target thing.

i'm using

timeToTarget = Mathf.Sqrt(2 * Distance / Projectile.MetersPerSecond);

or more generally

time = squareroot of 2 * distance / acceleration

or else using

time = distance / speed;

in the cases where speed is constant.

then the target i'm plotting an intercept for i have its current position and velocity.
so i aim at the point where the target will be time seconds ahead.

This is where the issue arrives though

the aimpoint time seconds ahead have a different distance (and therefore time to target)
then what i'm calculating.

so if the target is travelling fast enough i'd have to do the calculation again to get distance and time to target to the now known aimpoint.

Except of course the known aimpoint produces itself a new aimpoint.

Each time i get more approx close to the "true" intercept aimpoint.

But while i can try do something where i loop a algorithm and keep trying to find the aimpoint until i get within a certain tolerence i'm wondering if there is a better way.


I hope this comes across clearly. Basically I have a projectile going towards a target and i want to calculate the point to aim at which will allow me to hit the target given the targets position and speed and the projectiles position and speed.

But the issue i'm having is finding the distance between the target and the projectile because each projection of where the target will be changes the distance from what it was to the distance to the projection. Meaning the aimpoint now isn't correct.
 
ok so this is for a computer program.

I have the general idea of how to solve for one my issue is the whole moving target thing.

i'm using

timeToTarget = Mathf.Sqrt(2 * Distance / Projectile.MetersPerSecond);

or more generally

time = squareroot of 2 * distance / acceleration

or else using

time = distance / speed;

in the cases where speed is constant.

then the target i'm plotting an intercept for i have its current position and velocity.
so i aim at the point where the target will be time seconds ahead.

This is where the issue arrives though

the aimpoint time seconds ahead have a different distance (and therefore time to target)
then what i'm calculating.

so if the target is travelling fast enough i'd have to do the calculation again to get distance and time to target to the now known aimpoint.

Except of course the known aimpoint produces itself a new aimpoint.

Each time i get more approx close to the "true" intercept aimpoint.

But while i can try do something where i loop a algorithm and keep trying to find the aimpoint until i get within a certain tolerence i'm wondering if there is a better way.


I hope this comes across clearly. Basically I have a projectile going towards a target and i want to calculate the point to aim at which will allow me to hit the target given the targets position and speed and the projectiles position and speed.

But the issue i'm having is finding the distance between the target and the projectile because each projection of where the target will be changes the distance from what it was to the distance to the projection. Meaning the aimpoint now isn't correct.
Is the target moving with constant velocity? [Can't solve if you can't predict location.] Let the vector velocity of the target be
\(\displaystyle \vec{u} = (u_x, u_y, u_z)\)

Let the z-axis be vertical upward - this is the only component affected by gravity. The x and y components can be modified by a rotation in the horizontal plane, but you can't mix in the z-component because of gravity. Aim the gun upward by angle \(\displaystyle \theta\) and at a horizontal angle \(\displaystyle \phi\) measured toward the left (y-direction) of the line to the target (x-direction). Let the muzzle speed be \(\displaystyle v_0\). Then with respect to the moving target, the initial components of projectile velocity are

\(\displaystyle v_x = \;\;\;v_0\cos{\theta}\cos{\phi} - u_x\)
\(\displaystyle v_y = -v_0\cos{\theta}\sin{\phi} - u_y\)
\(\displaystyle v_z = \;\;\;v_0\sin{\theta} \;\;\;\;\;\;\;\;- u_z \)

Note that v_x and v_y are constant, and v_z is decreasing by the acceleration of gravity.
The equations of motion are

\(\displaystyle x = x_0 + v_x t\)
\(\displaystyle y = y_0 + v_y t\)
\(\displaystyle z = z_0 + v_z t - \frac{1}{2}g\ t^2\)

The x is the horizontal distance to the target, so time T can be defined as t when x=0. Does that get you going?
 
Last edited:
this is actually space so gravity is without.

the issue isn't that i cant predict where it will be

I can get the target velocity easily. The target knows its velocity at all times and I just ask it for it.
I can get the projectile velocity and the distance to target

time to target though is whats difficult because it changes because the aimpoint changes the distance to what i'm aiming at even if the time is frozen and the target doesn't move.

take for example

time to target = distance to target / speed of projectile.

that gets me how long it would take to hit the target if the target stood there.

however the target is moving so i don't want to aim there I want to aim where the target will be in time seconds from now

so the aimpoint is

aimpoint = target position + target velocity * time to target

now that will get me where the target will be in time seconds assuming it keeps going straight.

Thats fine.

But the issue is that now i'm no longer aiming at the target i'm aiming at the aimpoint

and the distance between the projectile starting point and the target and the projectile starting point and the aim point aren't the same.

if they were it would work.

so lets say the target is 100 meters away and travelling 100 meters per second and my bullet travels 100 meters per second.

then

time to target = 100 meters distance / 100 meters per second speed
time to target = 1 second

so then where will the object be in 1 second

aimpoint = current position + 100 meters (in whatever direction is away);

however this wont actualy result in me hitting the target per say.

Thats because I told it the distance to the target was 100 meters. and it is. Except the distance to the aimpoint isn't, its 200 meters to the aimpoint.
and now i'm actually aiming at the aimpoint.
so now i need to do another check basically repeat the process so that i can get an answer except the problem crops up again.

But the world has rocket scientists so i have doubts that there isn't a general equation for this kind of thing instead of looping the guess over and over to get a more approximately close answer.

but lets say for example the target is moving away at 100 feet per second well
 
Top