Class Engine::ColliderPlugin¶
ClassList > Engine > ColliderPlugin
Bundles collider data, collision events, and CollisionSystem .
#include <ColliderPlugin.hpp>
Inherits the following classes: Engine::IPlugin
Public Functions¶
| Type | Name |
|---|---|
| virtual void | Init (Registry & registry) override Registers collider-related components, Position , and the collision system. |
Public Functions inherited from Engine::IPlugin¶
See Engine::IPlugin
| Type | Name |
|---|---|
| virtual void | Init (Registry & registry) = 0 Initializes the plugin, registering components and systems. |
| virtual | ~IPlugin () = default |
Public Static Functions¶
| Type | Name |
|---|---|
| void | AttachToEntity (Registry & registry, Entity entity, const std::optional< ShapeComponent > & shape=std::nullopt, bool enabled=true, bool isTrigger=false) Attaches collider and event hooks to an entity. |
| void | AttachToEntity (Registry & registry, Entity entity, const ColliderComponent & collider) |
| bool | EntityHasShape (Registry & registry, Entity entity) True when the entity has a ShapeComponent and that type is registered. An unregisteredShapeComponent is not an error here. It means the entity has no shape. |
| std::optional< ShapeComponent > | ResolveShape (Registry & registry, Entity entity, const ColliderComponent & collider) Shape used for this collider. |
Public Functions Documentation¶
function Init¶
Registers collider-related components, Position , and the collision system.
Parameters:
registryMain ECS registry.
Implements Engine::IPlugin::Init
Public Static Functions Documentation¶
function AttachToEntity [½]¶
Attaches collider and event hooks to an entity.
static void Engine::ColliderPlugin::AttachToEntity (
Registry & registry,
Entity entity,
const std::optional< ShapeComponent > & shape=std::nullopt,
bool enabled=true,
bool isTrigger=false
)
Parameters:
registryMain ECS registry.entityTarget entity.shapeOptional shape that will be used to designate the areaenabledWhether collision queries include this collider.isTriggerTrigger vs solid semantics.
function AttachToEntity [2/2]¶
static void Engine::ColliderPlugin::AttachToEntity (
Registry & registry,
Entity entity,
const ColliderComponent & collider
)
function EntityHasShape¶
True when the entity has a ShapeComponent and that type is registered. An unregisteredShapeComponent is not an error here. It means the entity has no shape.
function ResolveShape¶
Shape used for this collider.
static std::optional< ShapeComponent > Engine::ColliderPlugin::ResolveShape (
Registry & registry,
Entity entity,
const ColliderComponent & collider
)
The collider's own shape wins. Otherwise the entity's ShapeComponent is used. When neither exists, the collider is skipped and one user error is reported.
The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Plugins/ColliderPlugin.hpp