From 7b061aee2b4c15d242bb9f18101d6b9ea776c5cd Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 1 Feb 2024 23:56:57 +0100 Subject: Walking movement --- src/Math/AABB.cpp | 1 + src/Math/AABB.hpp | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src/Math') 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; -- cgit 1.4.1