2023-01-18 14:42:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-01-26 23:52:25 +00:00
|
|
|
#include <glm/vec3.hpp>
|
|
|
|
#include <cstdint>
|
|
|
|
|
2023-01-18 14:42:09 +00:00
|
|
|
namespace engine {
|
|
|
|
|
|
|
|
class PhysicsSystem;
|
|
|
|
|
2023-01-22 18:20:10 +00:00
|
|
|
enum class ColliderType {
|
|
|
|
SPHERE,
|
|
|
|
PLANE,
|
|
|
|
};
|
|
|
|
|
2023-01-18 14:42:09 +00:00
|
|
|
struct ColliderComponent {
|
|
|
|
friend PhysicsSystem;
|
|
|
|
|
2023-01-22 18:20:10 +00:00
|
|
|
ColliderType colliderType;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
float r;
|
|
|
|
} sphereCollider;
|
|
|
|
} colliders;
|
2023-01-18 14:42:09 +00:00
|
|
|
|
2023-01-26 23:52:25 +00:00
|
|
|
auto getIsColliding() { return m_isColliding; }
|
|
|
|
auto getJustCollided() { return m_justCollided; }
|
|
|
|
auto getJustUncollided() { return m_justUncollided; }
|
|
|
|
auto getLastEntityCollided() { return m_lastEntityCollided; }
|
|
|
|
auto getLastCollisionNormal() { return m_lastCollisionNormal; }
|
2023-01-18 14:42:09 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_isColliding;
|
|
|
|
bool m_justCollided;
|
|
|
|
bool m_justUncollided;
|
2023-01-26 23:52:25 +00:00
|
|
|
uint32_t m_lastEntityCollided;
|
|
|
|
glm::vec3 m_lastCollisionNormal;
|
2023-01-18 14:42:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|