add triggers

This commit is contained in:
MihailRis
2024-06-30 16:25:08 +03:00
parent 50c714692a
commit 5769be8ec8
15 changed files with 239 additions and 64 deletions
+16
View File
@@ -1,8 +1,24 @@
#ifndef PHYSICS_HITBOX_HPP_
#define PHYSICS_HITBOX_HPP_
#include "../maths/aabb.hpp"
#include "../typedefs.hpp"
#include <set>
#include <functional>
#include <glm/glm.hpp>
struct Trigger {
bool enabled = true;
entityid_t entity;
AABB aabb;
AABB calculated;
std::set<entityid_t> prevEntered;
std::set<entityid_t> nextEntered;
std::function<void(entityid_t, size_t, entityid_t)> enterCallback;
std::function<void(entityid_t, size_t, entityid_t)> exitCallback;
};
struct Hitbox {
glm::vec3 position;
glm::vec3 halfsize;