From 0ae8c5aa7dc47a72ed8617eaf2e1556266434452 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 14 Nov 2026 08:48:47 +0400 Subject: fix(game): count full simulation intervals for player movement --- crates/fparkan-runtime/src/player_motion.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crates/fparkan-runtime/src/player_motion.rs') diff --git a/crates/fparkan-runtime/src/player_motion.rs b/crates/fparkan-runtime/src/player_motion.rs index 439429cd..7f88d41a 100644 --- a/crates/fparkan-runtime/src/player_motion.rs +++ b/crates/fparkan-runtime/src/player_motion.rs @@ -86,12 +86,17 @@ fn plan_motion( yaw }; let [right, forward] = input.movement.map(|axis| axis.clamp(-1.0, 1.0)); - let distance = 8.0 * input.delta_seconds.min(0.1) / right.hypot(forward).max(1.0); + let distance = 8.0 * input.delta_seconds / right.hypot(forward).max(1.0); let (sin, cos) = yaw.sin_cos(); let xy = [ from[0] + (cos * right - sin * forward) * distance, from[1] + (sin * right + cos * forward) * distance, ]; + if !xy.iter().all(|axis| axis.is_finite()) { + return Err(EngineError::Movement( + "player step exceeds finite coordinates".into(), + )); + } let mut sweep = None; if xy != [from[0], from[1]] { if let (Some(old_ground), Some(new_ground)) = ( -- cgit v1.2.3