summary refs log tree commit diff
path: root/src/Math
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-02-01 23:56:57 +0100
committerMel <einebeere@gmail.com>2024-02-01 23:56:57 +0100
commit7b061aee2b4c15d242bb9f18101d6b9ea776c5cd (patch)
tree66ef0166efb36146a58075e2e21e8c1c36fbd927 /src/Math
parent7b107078a2a3b9f62a076f91e873f5ad0597d167 (diff)
downloadmeowcraft-7b061aee2b4c15d242bb9f18101d6b9ea776c5cd.tar.zst
meowcraft-7b061aee2b4c15d242bb9f18101d6b9ea776c5cd.zip
Walking movement
Diffstat (limited to 'src/Math')
-rw-r--r--src/Math/AABB.cpp1
-rw-r--r--src/Math/AABB.hpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/Math/AABB.cpp b/src/Math/AABB.cpp
index b16960e..7f2c05d 100644
--- a/src/Math/AABB.cpp
+++ b/src/Math/AABB.cpp
@@ -29,5 +29,6 @@ AABB::CollisionResponse AABB::collision_response(Vector<3> v, AABB against) cons
     return {
         .v_to_collision = raycast.point - origin,
         .v_slide = projected_velocity,
+        .normal = raycast.normal,
     };
 }
diff --git a/src/Math/AABB.hpp b/src/Math/AABB.hpp
index b50ba56..b298126 100644
--- a/src/Math/AABB.hpp
+++ b/src/Math/AABB.hpp
@@ -83,6 +83,8 @@ struct AABB {
         // Velocity sliding along the collision plane.
         // Projection of the fraction of the original velocity that was blocked by collision, onto the collision plane.
         Vec3 v_slide;
+        // Normal of the collision plane.
+        Vec3 normal;
     };
     CollisionResponse collision_response(Vector<3> v, AABB against) const;