Address MR 2460 comments.

- Switch from point query to AABB query to take into account block thickness.
This commit is contained in:
Avi Weinstock 2021-06-15 22:52:02 -04:00
parent 5e6363dbcc
commit 96ffae4387

View File

@ -1290,7 +1290,11 @@ fn box_voxel_collision<'a, T: BaseVol<Vox = Block> + 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;
}