From e38ca0d9ab14f3f44dcff260e9a84cf08a2ad0b4 Mon Sep 17 00:00:00 2001 From: chexit Date: Mon, 2 Nov 2026 23:56:42 +0300 Subject: [PATCH] Match impact speed to swept segment Co-authored-by: Codex --- airdef-mod/src/sim/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airdef-mod/src/sim/mod.rs b/airdef-mod/src/sim/mod.rs index ae8bde0..6a4b2a2 100644 --- a/airdef-mod/src/sim/mod.rs +++ b/airdef-mod/src/sim/mod.rs @@ -3099,7 +3099,8 @@ impl Sim { let kill = self.rng.chance(spec.pk * fit * ratio); // The same swept closest approach determines the physical impact, not the // target's end-of-tick location. Velocities are per simulation tick. - impacts.insert(m.id, (t.pos - t.vel + t.vel * k, (m.vel - t.vel).length())); + let missile_step = if waiting.is_some() { end - before } else { m.pos - before }; + impacts.insert(m.id, (t.pos - t.vel + t.vel * k, (missile_step - t.vel).length())); missed += u32::from(!kill); done.push((m.id, Some(t.id), kill, m.sam)); continue;