Linear intercept for homing missiles.

So I’ve got a working missile using augmented proportional navigation.
However, I’m trying to incorporate the option to put the missile into a ballistic trajectory in anticipation of an unpowered missile stage.

In this case, I can’t use APN anymore, as a ballistic intercept requires the use of a linear intercept as a part of the calculation.

Now, in the case of dumb projectiles, linear intercept is pretty straight forward. You just need the shooter position, shooter velocity, target position, target velocity, and projectile speed.

But for a missile, some complications are introduced into the problem, because the shooter speed and shot speed are the same thing, and some care must be taken to separate the two.

Because the missile rigidbody doesn’t change direction instantly, you get some slide. Because of this, using the missile velocity as the shot speed becomes incorrect, since any portion of velocity not heading towards the target becomes an overestimation of the missile speed leading to undershoot.

So the solution seems to be getting the portion of the velocity headed towards the target and using that as the shot speed. Then subtracting that portion from the missile velocity to use as the current shooter velocity.

// Find the portion of velocity headed towards the target
Vector3 shotVelocity = Vector3.Project( missileRigidbody.velocity, target.position - transform.position );

// Subtract that portion of the missile's velocity when figuring shooter speed
Vector3 missileVelocity = missileRigidbody.velocity - shotVelocity;

It looks pretty straight forward, but the missile is still overestimating its speed with regard to intercept.

I’m not sure where my reasoning is flawed.
Any insight?

1 Like

Are you comparing global velocity of the missile vs. global velocity of the target? I would start there and see where that gets you. Your changes to the pathing then should look at how accel will apply in the global setting.

Well, rigidbody.velocity is global, is it not? As opposed to local velocity? Then, yes, values are global.
The intercept formula works perfectly for a fired projectile, it’s trying to adapt it to a missile that is problematic.
I don’t think I made any errors in actual implementation, but rather, that my solution is flawed in principle.

The problem, is that the missile velocity will eventually become the shot speed, but when the missile isn’t actually moving in the correct direction, its full velocity can’t be used as shot speed. Instead, it needs to aim as if it’s closing velocity is the shot speed.
However, its total velocity can’t then be ignored because that slide need to be accounted for and countered with the aim as well. But using both is wrong because it would effectively be adding closing velocity portion twice.
So, I figured I could extract the closing velocity, but it’s just not working. But I think the math is correct, so the principle must be wrong somehow.

1 Like