summary refs log tree commit diff
path: root/src/Math/AABB.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Math/AABB.hpp')
-rw-r--r--src/Math/AABB.hpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Math/AABB.hpp b/src/Math/AABB.hpp
index 19aa81c..22de760 100644
--- a/src/Math/AABB.hpp
+++ b/src/Math/AABB.hpp
@@ -8,6 +8,13 @@ struct AABB {
     AABB(Vector<3> min, Vector<3> max) : min(min), max(max) {}
     explicit AABB(Vector<3> max) : max(max) {}
 
+    static AABB from_center(Vector<3> center, Vector<3> size) {
+        auto min = center - size / 2.0;
+        auto max = min + size;
+
+        return {min, max};
+    }
+
     Vector<3> size() const { return max - min; }
     Vector<3> center() const { return (min + max) / 2; }
 
@@ -53,7 +60,7 @@ struct AABB {
         return {center() - new_size / 2, center() + new_size / 2};
     }
 
-    AABB cast_box(Vector<3> v, AABB against) const;
+    AABB collision_response(Vector<3> v, AABB against) const;
 
     Vector<3> min, max;
 };