diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-26 04:45:53 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-26 04:45:53 +0300 |
| commit | 531753ef5fbfa846b4291864458f511d5c7e1b59 (patch) | |
| tree | ad71fdb5a50ff880fc202d85114c41a5877be276 /crates/fparkan-runtime/src/route_motion.rs | |
| parent | 6ed1829936f23c92b9aec24e0eef6884876bb99b (diff) | |
| download | fparkan-531753ef5fbfa846b4291864458f511d5c7e1b59.tar.xz fparkan-531753ef5fbfa846b4291864458f511d5c7e1b59.zip | |
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.
Diffstat (limited to 'crates/fparkan-runtime/src/route_motion.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/route_motion.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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<FlightClearance>, + pub(super) ground: Option<GroundSupport>, } pub(super) fn route_points( @@ -55,6 +57,7 @@ pub(super) fn follow_route( clearance: RouteClearance<'_>, mut height_at: impl FnMut([f32; 2]) -> Result<Option<f32>, 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)) } |
