5#include <glm/gtc/quaternion.hpp>
6#include <entt/entt.hpp>
Base class for collision shape components.
btCollisionShape * getShape() const
Gets the current collision shape.
static constexpr bool IsUnique
glm::mat4 getLocalTransform() const
Gets the local transform matrix.
btCollisionShape * shape_
void endPlay() override
Called when the component is removed or the game ends.
virtual void destroyShape()
Destroys the current shape.
PhysicsBodyComponent * bodyComponent_
virtual void onCollisionStay(CollisionComponent *other)
Called every frame while colliding with another object.
virtual void onCollisionBegin(CollisionComponent *other)
Called when a collision with another object begins.
void setIsTrigger(bool trigger)
Sets whether this collision is a trigger (overlap only, no physics response).
void unregisterFromBody()
virtual void onCollisionEnd(CollisionComponent *other)
Called when a collision with another object ends.
virtual btCollisionShape * createShape()=0
Creates the Bullet collision shape. Must be implemented by derived classes.
bool isTrigger() const
Checks if this collision is a trigger.
glm::vec3 getLocalOffset() const
Gets the local position offset.
void setLocalOffset(const glm::vec3 &offset)
Sets the local position offset relative to the body.
~CollisionComponent() override
void beginPlay() override
Called when the component is added to the scene or the game starts.
void setLocalRotation(const glm::quat &rotation)
Sets the local rotation relative to the body.
glm::quat getLocalRotation() const
Gets the local rotation.
PhysicsBodyComponent * getBodyComponent() const
Gets the physics body component this collision is registered with.
CollisionComponent(Scene *scene, entt::entity entity)
Constructs a CollisionComponent.
void markDirty()
Marks the shape as needing rebuild. Call after changing shape properties (halfExtents,...
friend class PhysicsBodyComponent
void rebuild()
Rebuilds the shape and notifies PhysicsBodyComponent.
LogicComponent(Scene *owningScene)
Component that manages a physics rigid body for an entity.
A scene is the overarching structure which can spawn actors.
Log category system implementation.