From 5e0400579fad7c1eff148a151772029ae1ee4f30 Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Tue, 24 Aug 2021 23:26:08 +1000 Subject: [PATCH 1/2] Document collide args --- crates/bevy_sprite/src/collide_aabb.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/bevy_sprite/src/collide_aabb.rs b/crates/bevy_sprite/src/collide_aabb.rs index 136793cb7ea82..e904fa9f17e49 100644 --- a/crates/bevy_sprite/src/collide_aabb.rs +++ b/crates/bevy_sprite/src/collide_aabb.rs @@ -12,6 +12,8 @@ pub enum Collision { // TODO: ideally we can remove this once bevy gets a physics system /// Axis-aligned bounding box collision with "side" detection +/// * a_pos and b_pos are the center positions of the rectangles. (This is different to traditional AABB where the position is the corner) +/// * a_size and b_size are the dimensions (width and height) of the rectangles. pub fn collide(a_pos: Vec3, a_size: Vec2, b_pos: Vec3, b_size: Vec2) -> Option { let a_min = a_pos.truncate() - a_size / 2.0; let a_max = a_pos.truncate() + a_size / 2.0; From 33205842448c37e6d670f70a70c4624251437f52 Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Tue, 24 Aug 2021 23:40:51 +1000 Subject: [PATCH 2/2] reword Co-authored-by: Alice Cecile --- crates/bevy_sprite/src/collide_aabb.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/collide_aabb.rs b/crates/bevy_sprite/src/collide_aabb.rs index e904fa9f17e49..8296b359afd04 100644 --- a/crates/bevy_sprite/src/collide_aabb.rs +++ b/crates/bevy_sprite/src/collide_aabb.rs @@ -12,7 +12,7 @@ pub enum Collision { // TODO: ideally we can remove this once bevy gets a physics system /// Axis-aligned bounding box collision with "side" detection -/// * a_pos and b_pos are the center positions of the rectangles. (This is different to traditional AABB where the position is the corner) +/// * a_pos and b_pos are the center positions of the rectangles, typically obtained by extracting the `translation` field from a `Transform` component /// * a_size and b_size are the dimensions (width and height) of the rectangles. pub fn collide(a_pos: Vec3, a_size: Vec2, b_pos: Vec3, b_size: Vec2) -> Option { let a_min = a_pos.truncate() - a_size / 2.0;