diff options
| author | Mel <einebeere@gmail.com> | 2024-02-05 13:48:13 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2024-02-05 13:48:13 +0100 |
| commit | 091bf9e418ffdcf36e1735ed78d544f3d1b86785 (patch) | |
| tree | 58b1cd88d9822b14c90da757cc26acb64bf9bad5 /src/Math/AABB.hpp | |
| parent | bcb89e0554e43d37daf74b3ef6e466b6630752cd (diff) | |
| download | meowcraft-091bf9e418ffdcf36e1735ed78d544f3d1b86785.tar.zst meowcraft-091bf9e418ffdcf36e1735ed78d544f3d1b86785.zip | |
More precise collision detection (and less NaNs)
Diffstat (limited to 'src/Math/AABB.hpp')
| -rw-r--r-- | src/Math/AABB.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Math/AABB.hpp b/src/Math/AABB.hpp index b298126..bff543e 100644 --- a/src/Math/AABB.hpp +++ b/src/Math/AABB.hpp @@ -27,15 +27,15 @@ struct AABB { } Bool intersects_on_x(AABB other) const { - return min.x() <= other.max.x() && max.x() >= other.min.x(); + return Math::floats_less(min.x(), other.max.x()) && Math::floats_less(other.min.x(), max.x()); } Bool intersects_on_y(AABB other) const { - return min.y() <= other.max.y() && max.y() >= other.min.y(); + return Math::floats_less(min.y(), other.max.y()) && Math::floats_less(other.min.y(), max.y()); } Bool intersects_on_z(AABB other) const { - return min.z() <= other.max.z() && max.z() >= other.min.z(); + return Math::floats_less(min.z(), other.max.z()) && Math::floats_less(other.min.z(), max.z()); } Bool collides(AABB other) const { |
