RIM-116 & Phalanx
Missile guidance
Script-driven rather than physics-driven, because what matters is that it flies convincingly and fuzes on time.
Script movement, not physics
A physically simulated airframe needs a lift and control-surface model. Here only two things matter: that the
flight looks right and that the fuze triggers at the right moment. Move the missile through
SetWorldTransform so attitude and position change in one step.
| Parameter | Example value | Note |
|---|---|---|
| Speed | about Mach 2 | |
| Agility | a turn rate in degrees per second | from a limit in g: ω = a / v |
| Seeker handover | a distance before impact | against ground targets and projectiles |
| Seeker field of view | a half angle | |
| Proximity fuze | a few metres | fragmentation reaches further than the fuze |
Two phases
The run-in flies the intercept point the fire control computed. The endgame hands over to the seeker, which tracks the target itself – and that is the phase a flare can break.
A miss report you can act on
“The shot missed” says nothing about what to change. A deviation along the target's flight direction means the lead was wrong. A deviation across it means something else: scatter, aim error, or a target that dodged. High or low points at the ballistics. So report the decomposition along the axes the target defines.
void MyAD_Missile_ReportMiss(vector missilePos)
{
vector off = missilePos - TargetPos();
float speed = TargetVel().Length();
if (speed < 1.0) // a still target has no "ahead" or "behind"
{
Print(string.Format("miss %1 m (target still)", off.Length()));
return;
}
vector along = TargetVel() / speed;
vector lateral = Vector(-along[2], 0, along[0]); // cross with the vertical, written out
lateral.Normalize();
Print(string.Format("miss %1 m: along %2 (+ = ahead of target), lateral %3, high %4",
off.Length(), vector.Dot(off, along), vector.Dot(off, lateral), off[1]));
}
This earned its place at once. The report was that a gun almost never hit modified helicopters and “the rounds
always land just short”. That is directly testable: a consistently positive along means the lead is
too large.
Closest approach, not the self-destruct point
A miss flies on until its maximum range runs out, so a deviation measured where it self-destructs says little: a shot fired at 1 km with a range of 4 km flies 3 km further after passing the target, and the deviation would read kilometres whether it missed by two metres or two hundred. The number that really says how well the fire control aimed is the closest approach: the smallest distance measured in any frame of the flight.
void MyAD_Missile_Frame(float dt)
{
float d = vector.Distance(GetOwner().GetOrigin(), TargetPos());
if (d < m_fClosest)
m_fClosest = d; // kept for the report, whether or not the fuze fired
}