From fef392a8cc693ae28cd9d3a195936f654bcebe82 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Fri, 6 Aug 2021 04:28:44 -0500 Subject: [PATCH] Correctly calcuate area AABBs. --- src/map.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/map.rs b/src/map.rs index 5e9a189..19a9d95 100644 --- a/src/map.rs +++ b/src/map.rs @@ -332,9 +332,11 @@ fn spawn_colliders( } } for room in &map.rooms { - let shape = - ColliderShape::cuboid((room.width() / 2) as f32, (room.height() / 2) as f32); - let position = Vec2::new(room.center().x(), room.center().y()).into(); + let shape = ColliderShape::cuboid( + (room.width() / 2) as f32 + 0.5, + (room.height() / 2) as f32 + 0.5, + ); + let position = Vec2::new(room.center().x() + 0.5, room.center().y() + 0.5).into(); commands .spawn_bundle(ColliderBundle { collider_type: ColliderType::Sensor,