From 3f3eb637c4cc6dce9ecfbf032b5bf549703a4a79 Mon Sep 17 00:00:00 2001 From: Imbris Date: Thu, 25 Mar 2021 00:52:42 -0400 Subject: [PATCH] Do iteration check for snapping after checking the other conditions --- common/systems/src/phys.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/common/systems/src/phys.rs b/common/systems/src/phys.rs index 3f395f73e1..1a6a5cae3f 100644 --- a/common/systems/src/phys.rs +++ b/common/systems/src/phys.rs @@ -1651,7 +1651,7 @@ fn box_voxel_collision<'a, T: BaseVol + ReadVol>( if on_ground.is_some() { physics_state.on_ground = on_ground; // If the space below us is free, then "snap" to the ground - } else if { + } else if vel.0.z <= 0.0 && was_on_ground && block_snap && { prof_span!("snap check"); collision_with( pos.0 - Vec3::unit_z() * 1.1, @@ -1661,10 +1661,7 @@ fn box_voxel_collision<'a, T: BaseVol + ReadVol>( radius, z_range.clone(), ) - } && vel.0.z <= 0.0 - && was_on_ground - && block_snap - { + } { prof_span!("snap!!"); let snap_height = terrain .get(Vec3::new(pos.0.x, pos.0.y, pos.0.z - 0.1).map(|e| e.floor() as i32))