aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/CollisionSystem.h
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-11-14 21:04:39 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-11-14 21:04:39 +0100
commitc9c132989053c5fcfb2b7e8d9f2c48a1896764f3 (patch)
tree2548357103d8bd7dda170270c57fbdc786974ee6 /src/crepe/system/CollisionSystem.h
parentb748691ea7aab8bd12ed76e81f9e9b4539e7d2f7 (diff)
improving how to save collisions
Diffstat (limited to 'src/crepe/system/CollisionSystem.h')
-rw-r--r--src/crepe/system/CollisionSystem.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/crepe/system/CollisionSystem.h b/src/crepe/system/CollisionSystem.h
index 23e8245..a4c6ecb 100644
--- a/src/crepe/system/CollisionSystem.h
+++ b/src/crepe/system/CollisionSystem.h
@@ -2,6 +2,7 @@
#include "Collider.h"
#include <vector>
+#include <variant>
namespace crepe {
@@ -16,7 +17,10 @@ public:
CollisionSystem();
void update();
private:
- std::vector<std::pair<int, int>> check_collisions(const std::vector<std::reference_wrapper<BoxCollider>>& boxcolliders, const std::vector<std::reference_wrapper<CircleCollider>>& circlecolliders) ;
+ using collider_stor = std::variant<BoxCollider, CircleCollider>;
+private:
+ void call_collision_handler(const Rigidbody& rigidbody1,const Rigidbody& rigidbody2);
+ std::vector<std::pair<collider_stor, collider_stor>> check_collisions(const std::vector<std::reference_wrapper<BoxCollider>>& boxcolliders, const std::vector<std::reference_wrapper<CircleCollider>>& circlecolliders);
bool check_box_box_collision(const BoxCollider& box1, const BoxCollider& box2, const Transform& transform1, const Transform& transform2, const Rigidbody& rigidbody1, const Rigidbody& rigidbody2);
bool check_box_circle_collision(const BoxCollider& box1, const CircleCollider& circle2, const Transform& transform1, const Transform& transform2, const Rigidbody& rigidbody1, const Rigidbody& rigidbody2);
bool check_circle_circle_collision(const CircleCollider& circle1, const CircleCollider& circle2, const Transform& transform1, const Transform& transform2, const Rigidbody& rigidbody1, const Rigidbody& rigidbody2);