From 96ffae4387e5e87603bd907e20fbb7a195fdf594 Mon Sep 17 00:00:00 2001 From: Avi Weinstock Date: Tue, 15 Jun 2021 22:52:02 -0400 Subject: [PATCH] Address MR 2460 comments. - Switch from point query to AABB query to take into account block thickness. --- common/systems/src/phys.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/systems/src/phys.rs b/common/systems/src/phys.rs index ab6ac06eb4..5852454f5f 100644 --- a/common/systems/src/phys.rs +++ b/common/systems/src/phys.rs @@ -1290,7 +1290,11 @@ fn box_voxel_collision<'a, T: BaseVol + ReadVol>( min: pos + Vec3::new(-radius, -radius, z_range.start), max: pos + Vec3::new(radius, radius, z_range.end), }; - if !player_aabb.contains_point(block_pos.as_() + Vec3::broadcast(0.5)) { + let block_approx = Aabb { + min: block_pos.as_(), + max: block_pos.as_() + Vec3::new(1.0, 1.0, Block::MAX_HEIGHT), + }; + if !player_aabb.collides_with_aabb(block_approx) { return None; }