From be3b214702693eab36da4484624327d2cad8beec Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 1 Dec 2026 06:17:23 +0400 Subject: fix(gameplay): ground the hero when a warbot is destroyed A passenger kept the destroyed chassis root height and carried that offset into walking. In Two Fortresses this left the hero above the entrance to the last bunker. Put the hero on the terrain at the last chassis position, and retain the current elevation when the chassis was on a building floor. The licensed chassis test reproduces the old height and verifies the ejection after projectile damage. The stock Two Fortresses replay confirms the height correction during combat. Workspace checks and a Vulkan validation run from the normal start passed. Native ejection placement and the flying vehicle case remain open. --- crates/fparkan-runtime/src/player_motion.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (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 525bc7b3..73129d87 100644 --- a/crates/fparkan-runtime/src/player_motion.rs +++ b/crates/fparkan-runtime/src/player_motion.rs @@ -27,7 +27,7 @@ pub(super) fn drowns(engine: &Engine, cockpit: StartingCockpit, step: PlayerMoti // shortcut: bound stair steps and drops until the native hero collider is wired. const STEP_UP: f32 = 0.85; const STEP_DOWN: f32 = 2.0; -const FLOOR_CLEARANCE: f32 = 0.02; +pub(super) const FLOOR_CLEARANCE: f32 = 0.02; const WATER_SURFACE: u32 = 0x0002_0000; // shortcut: sample the temporary floor probe at most 0.16 units apart until native collision is wired. const WALK_COLLISION_DISTANCE: f32 = 0.16; @@ -620,9 +620,14 @@ pub(super) fn commit_motion_state( mission.hero_look = look; } } - if let (Some(boarding), Some(velocity)) = (&mut mission.boarding, step.flight_velocity) { - if boarding.cockpit.handle == cockpit.handle { + if let Some(boarding) = &mut mission.boarding { + if boarding.cockpit.handle != cockpit.handle { + return; + } + if let Some(velocity) = step.flight_velocity { boarding.flight_velocity = if blocked { [0.0; 3] } else { velocity }; + } else if !blocked && step.sweep.is_some() { + boarding.on_building_floor = step.on_building_floor(); } } } -- cgit v1.2.3