diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-07 15:24:51 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-07 15:24:51 +0100 |
commit | 478f5f6232c46e1a60c023bf5dcbe2a934f42d84 (patch) | |
tree | 7788dc9ae1f340d30565a92c38aa87d962cb06fe /src/crepe/system/CollisionSystem.cpp | |
parent | fdb4c99e139a264d4e15e6913a3756fc6cccb2f2 (diff) | |
parent | 33a072db28d71ba65e59f9491abd42dbf9695fc4 (diff) |
pulled AI
Diffstat (limited to 'src/crepe/system/CollisionSystem.cpp')
-rw-r--r-- | src/crepe/system/CollisionSystem.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/crepe/system/CollisionSystem.cpp b/src/crepe/system/CollisionSystem.cpp index 44a0431..6b1954e 100644 --- a/src/crepe/system/CollisionSystem.cpp +++ b/src/crepe/system/CollisionSystem.cpp @@ -182,7 +182,11 @@ CollisionSystem::collision_handler(CollisionInternal & data1, CollisionInternal vec2 collider_pos2 = this->get_current_position(collider2.offset, data2.transform, data2.rigidbody); resolution = this->get_circle_box_resolution(collider1, collider2, collider_pos1, +<<<<<<< HEAD collider_pos2); +======= + collider_pos2, false); +>>>>>>> 33a072db28d71ba65e59f9491abd42dbf9695fc4 break; } } @@ -268,7 +272,12 @@ vec2 CollisionSystem::get_circle_circle_resolution(const CircleCollider & circle vec2 CollisionSystem::get_circle_box_resolution(const CircleCollider & circle_collider, const BoxCollider & box_collider, const vec2 & circle_position, +<<<<<<< HEAD const vec2 & box_position) const { +======= + const vec2 & box_position, + bool inverse) const { +>>>>>>> 33a072db28d71ba65e59f9491abd42dbf9695fc4 vec2 delta = circle_position - box_position; // Compute half-dimensions of the box @@ -290,7 +299,11 @@ vec2 CollisionSystem::get_circle_box_resolution(const CircleCollider & circle_co // Compute penetration depth float penetration_depth = circle_collider.radius - distance; +<<<<<<< HEAD +======= + if (inverse) collision_normal = -collision_normal; +>>>>>>> 33a072db28d71ba65e59f9491abd42dbf9695fc4 // Compute the resolution vector vec2 resolution = collision_normal * penetration_depth; |