← Home SEEBIE90 DOCS
The RIM-116 & Phalanx mod is published under the Arma Public License (APL)Example code is free to useSuggestions: Discord to the author

RIM-116 & Phalanx

Missile guidance

Script-driven rather than physics-driven, because what matters is that it flies convincingly and fuzes on time.

In plain wordsThe missile flies to the predicted point, hands over to an infrared seeker for the last stretch, and detonates close to the target.

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.

ParameterExample valueNote
Speedabout Mach 2
Agilitya turn rate in degrees per secondfrom a limit in g: ω = a / v
Seeker handovera distance before impactagainst ground targets and projectiles
Seeker field of viewa half angle
Proximity fuzea few metresfragmentation 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.

PitfallLifting the flight path over terrain is right for a missile flying low over ground and WRONG for a gun round: a lifted round misses exactly what the fire control aimed at. Make it an attribute per weapon type.
NoteFast projectiles tunnel through thin colliders. Anything that looks like a missing hit at high speed should be re-tested with a slow weapon before the guidance is blamed.

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.

Example code – free to use
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.

Example code – free to use
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
}
Example code on this page is free to use in your own projects (credit appreciated). The RIM-116 & Phalanx mod is published under the Arma Public License (APL). Suggestions: Discord. Arma Reforger / Enfusion are trademarks of Bohemia Interactive.
Impressum · Privacy Policy