Skip to content

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.

virtual void Engine::ColliderPlugin::Init (
    Registry & registry
) override

Parameters:

  • registry Main 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:

  • registry Main ECS registry.
  • entity Target entity.
  • shape Optional shape that will be used to designate the area
  • enabled Whether collision queries include this collider.
  • isTrigger Trigger 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.

static bool Engine::ColliderPlugin::EntityHasShape (
    Registry & registry,
    Entity entity
) 


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