42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#ifndef CCOLLIDER_HPP
|
|
#define CCOLLIDER_HPP
|
|
#include "CAbstractCollider.hpp"
|
|
#include <Jolt/Jolt.h>
|
|
#include <Jolt/Physics/Collision/Shape/Shape.h>
|
|
#include "../../Graphics/Data/Mesh/CMesh.hpp"
|
|
#include "nlohmann/json_fwd.hpp"
|
|
|
|
namespace CosmicCore {
|
|
|
|
enum class EColliderType {
|
|
Box,
|
|
Sphere,
|
|
Capsule,
|
|
ConvexHull,
|
|
Mesh,
|
|
Compound
|
|
};
|
|
|
|
class CCollider : public CAbstractCollider{
|
|
private:
|
|
EColliderType m_type;
|
|
JPH::ShapeRefC m_shape = nullptr;
|
|
public:
|
|
CCollider(CEntity& e, EColliderType type);
|
|
|
|
void buildFromMesh(CMesh* mesh);
|
|
void buildDefaultShape();
|
|
|
|
JPH::ShapeRefC getShape() const { return m_shape; }
|
|
EColliderType getType() const { return m_type; }
|
|
|
|
void setCapsule(float halfHeight, float radius);
|
|
void setSphereRadius(float radius);
|
|
void setBoxSize(glm::vec3 size);
|
|
void buildFromRenderer();
|
|
|
|
nlohmann::json to_json(){return nlohmann::json();};
|
|
};
|
|
}
|
|
|
|
#endif |