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
This commit is contained in:
@@ -481,19 +481,25 @@ pub(in crate::net) fn ground_clamp_creatures(
|
||||
// extents are not built.
|
||||
capsule: Res<crate::player::PlayerCapsule>,
|
||||
mut commands: Commands,
|
||||
mut q: Query<(
|
||||
Entity,
|
||||
&NetEntity,
|
||||
Option<&Spline>,
|
||||
&mut Transform,
|
||||
Option<&mut GroundClamped>,
|
||||
Has<CreatureSwimming>,
|
||||
// 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<crate::net::Embodied>,
|
||||
Has<crate::net::RemoteMotion>,
|
||||
)>,
|
||||
mut q: Query<
|
||||
(
|
||||
Entity,
|
||||
&NetEntity,
|
||||
Option<&Spline>,
|
||||
&mut Transform,
|
||||
Option<&mut GroundClamped>,
|
||||
Has<CreatureSwimming>,
|
||||
// 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<crate::net::Embodied>,
|
||||
Has<crate::net::RemoteMotion>,
|
||||
),
|
||||
// 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<crate::entities::mount::MountBody>,
|
||||
>,
|
||||
) {
|
||||
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<SwimMarkQuery, SwimMarkGate>,
|
||||
// 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<SwimMarkQuery, (SwimMarkGate, Without<crate::entities::mount::MountBody>)>,
|
||||
stamped: Query<Entity, With<SwimEvaluated>>,
|
||||
world: benilla_world::world_point::WorldPoint,
|
||||
epoch: Res<benilla_world::collision::ColliderEpoch>,
|
||||
|
||||
Reference in New Issue
Block a user