From c5717b5a9124c7c2f7431c4be07f15243ebd60b5 Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Tue, 24 Aug 2021 18:07:51 +0000 Subject: [PATCH] Document collide args (#2721) Fixes https://github.com/bevyengine/bevy/issues/2720#issuecomment-904623168 Possibly we should omit the extra bit in brackets, not sure if its warranted. --- 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..8296b359afd04 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, 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; let a_max = a_pos.truncate() + a_size / 2.0;