From 531753ef5fbfa846b4291864458f511d5c7e1b59 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 05:45:53 +0400 Subject: fix(movement): ground chassis on their lowest mesh points Sample the terrain under four support points in the initial chassis pose. Preserve any existing positive clearance above support and recalculate the root height after moving or turning, so a low start does not carry penetration across the route. The stock heavy AutoDemo chassis previously put its root at Z 2 with support at Z 2.9537. The same regression now passes. Verified uneven support and descent, all workspace checks, the 29-mission simulation corpus and an AutoDemo window run with clean Vulkan validation. --- crates/fparkan-runtime/src/route_motion.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/fparkan-runtime/src/route_motion.rs') diff --git a/crates/fparkan-runtime/src/route_motion.rs b/crates/fparkan-runtime/src/route_motion.rs index 59b7f766..5ebaae78 100644 --- a/crates/fparkan-runtime/src/route_motion.rs +++ b/crates/fparkan-runtime/src/route_motion.rs @@ -2,6 +2,7 @@ use crate::{ flight_altitude::FlightClearance, + ground_support::GroundSupport, route_obstacles::{open_leg, Footprint}, EngineError, TerrainWorld, TransformState, }; @@ -15,6 +16,7 @@ pub(super) struct RouteClearance<'a> { pub(super) buildings: &'a [Footprint], pub(super) traffic: &'a [Footprint], pub(super) flight: Option, + pub(super) ground: Option, } pub(super) fn route_points( @@ -55,6 +57,7 @@ pub(super) fn follow_route( clearance: RouteClearance<'_>, mut height_at: impl FnMut([f32; 2]) -> Result, EngineError>, ) -> Result<(TransformState, Footprint), EngineError> { + let before = pose; let [mut x, mut y, mut z] = pose.position.map(f32::from_bits); let mut swept = Footprint::point([x, y]); if let Some(flight) = clearance.flight { @@ -123,6 +126,9 @@ pub(super) fn follow_route( points.pop_front(); seconds -= travel_time; } + if let Some(ground) = clearance.ground { + ground.reanchor(before, &mut pose, height_at)?; + } Ok((pose, swept)) } -- cgit v1.2.3