From a9f0a786ce11586294dc86b4ccbc4f02aa5215b4 Mon Sep 17 00:00:00 2001 From: CobaltXII Date: Tue, 1 Jan 2019 12:10:06 -0500 Subject: [PATCH] Implemented inline bool hitbox_intersect --- src/inc/hitbox.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/inc/hitbox.hpp b/src/inc/hitbox.hpp index 61bda62..2a3d1ec 100644 --- a/src/inc/hitbox.hpp +++ b/src/inc/hitbox.hpp @@ -30,3 +30,15 @@ struct hitbox zr = _zr; } }; + +// Check if two hitboxes intersect. + +inline bool hitbox_intersect(hitbox a, hitbox b) +{ + return + ( + (a.x <= b.x + b.xr && a.x + a.xr >= b.x) && + (a.y <= b.y + b.yr && a.y + a.yr >= b.y) && + (a.z <= b.z + b.zr && a.z + a.zr >= b.z) + ); +}