From 2796a5d78d0483e04b722a3fb391f94fed9f4dd5 Mon Sep 17 00:00:00 2001 From: chairmanpow Date: Tue, 6 Oct 2026 19:11:34 +0100 Subject: [PATCH] fix: the ground clamp skips a mount child, so mounted players stop sinking A mount child is an EntityKind::Unit but rides its host, so its Transform is host-local (0,0,0). ground_clamp_creatures cast a world ray from that origin and wrote the world floor height into the child's local Y, dropping the mount into the terrain; in Alterac Valley the map origin sits on live ground, so mounted players showed half under the map. ground_clamp_creatures and mark_swimming_creatures now exclude MountBody, as every other mount-aware system already does. Fixes #4 --- crates/benilla-app/src/net/motion/spline.rs | 36 +++++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/crates/benilla-app/src/net/motion/spline.rs b/crates/benilla-app/src/net/motion/spline.rs index 37aeaf23..588df733 100644 --- a/crates/benilla-app/src/net/motion/spline.rs +++ b/crates/benilla-app/src/net/motion/spline.rs @@ -481,19 +481,25 @@ pub(in crate::net) fn ground_clamp_creatures( // extents are not built. capsule: Res, mut commands: Commands, - mut q: Query<( - Entity, - &NetEntity, - Option<&Spline>, - &mut Transform, - Option<&mut GroundClamped>, - Has, - // HOVER and WATERWALKING both move the answer. - Option<&crate::net::UnitMoveModes>, - // [`ground_derived`]'s other Z authorities: the controller and the relay's dead-reckoning. - Has, - Has, - )>, + mut q: Query< + ( + Entity, + &NetEntity, + Option<&Spline>, + &mut Transform, + Option<&mut GroundClamped>, + Has, + // HOVER and WATERWALKING both move the answer. + Option<&crate::net::UnitMoveModes>, + // [`ground_derived`]'s other Z authorities: the controller and the relay's + // dead-reckoning. + Has, + Has, + ), + // A mount child is kind `Unit` but rides its host: its `Transform` is host-local, so a + // world ray from `(0, 0, 0)` would write the world origin's floor into its local Y. + Without, + >, ) { let cost = clamp_cost_enabled(); let legacy = clamp_seat_disabled(); @@ -843,7 +849,9 @@ fn creature_swim_state(marked: bool, depth: f32, boundary: f32, unit_flags: u32) /// Chained before [`ground_clamp_creatures`] so a fresh mark exempts the clamp the same frame. pub(in crate::net) fn mark_swimming_creatures( mut commands: Commands, - units: Query, + // A mount child rides its host: a host-local `Transform` cannot answer a world water query, and + // the clamp beside this system must walk the same population. + units: Query)>, stamped: Query>, world: benilla_world::world_point::WorldPoint, epoch: Res,