CollisionConfig Class
Fluent configuration for collision detection setup. More...
Declaration
Public Constructors Index
| CollisionConfig (helios::engine::ecs::GameObject gameObject) | |
|
Constructs a CollisionConfig and adds CollisionStateComponent. More... | |
Public Member Functions Index
| CollisionConfig & | useBoundingBox () |
|
Adds AABB collider for bounding box collision. More... | |
| CollisionConfig & | layerId (const uint32_t layerId) |
|
Sets the collision layer ID. More... | |
| CollisionConfig & | hitPolicy (const helios::engine::modules::physics::collision::types::HitPolicy hitPolicy) |
|
Sets the hit policy for collision detection. More... | |
| CollisionConfig & | reportCollisions (bool isCollisionReporter) |
|
Sets whether this entity reports collisions. More... | |
| CollisionConfig & | solidCollisionMask (const uint32_t solidCollisionMask) |
|
Sets the solid collision mask. More... | |
| CollisionConfig & | onSolidCollision (const uint32_t otherLayerId, const helios::engine::modules::physics::collision::types::CollisionBehavior collisionBehavior) |
|
Adds a collision behavior for a specific layer. More... | |
| CollisionConfig & | dealDamage (const float damageAmount, const uint32_t otherLayerId) |
|
Configures damage dealing on collision with a specific layer. More... | |
Private Member Functions Index
| void | ensureCollisionComponent (const bool isAvailable) const noexcept |
|
Validates CollisionComponent presence. More... | |
Private Member Attributes Index
| helios::engine::ecs::GameObject | gameObject_ |
|
Non-owning pointer to the target GameObject. More... | |
Description
Fluent configuration for collision detection setup.
Automatically adds CollisionStateComponent and provides methods for configuring collision layers, masks, and behaviors.
Definition at line 27 of file CollisionConfig.ixx.
Public Constructors
CollisionConfig()
| inline explicit |
Constructs a CollisionConfig and adds CollisionStateComponent.
- Parameters
-
<a href="/docs/helios/namespaces/helios/engine/builder/gameobject">gameObject</a> Target GameObject to configure.
Definition at line 58 of file CollisionConfig.ixx.
Referenced by dealDamage, hitPolicy, layerId, onSolidCollision, reportCollisions, solidCollisionMask and useBoundingBox.
Public Member Functions
dealDamage()
| inline |
Configures damage dealing on collision with a specific layer.
Adds or updates a DamageDealerComponent to deal the specified damage when colliding with entities on the given layer.
- Parameters
-
damageAmount The amount of damage to deal.
otherLayerId The layer to deal damage to.
- Returns
Reference to this config for chaining.
Definition at line 175 of file CollisionConfig.ixx.
Reference CollisionConfig.
hitPolicy()
| inline |
Sets the hit policy for collision detection.
Controls how many collision events this entity receives per frame:
- `OneHit`: Only the first collision is reported (default)
- `All`: All collisions with overlapping entities are reported
- Parameters
-
hitPolicy The hit policy to apply.
- Returns
Reference to this config for chaining.
- See Also
HitPolicy
Definition at line 103 of file CollisionConfig.ixx.
References CollisionConfig and hitPolicy.
Referenced by hitPolicy.
layerId()
| inline |
Sets the collision layer ID.
- Parameters
-
layerId The layer this entity belongs to.
- Returns
Reference to this config for chaining.
Definition at line 81 of file CollisionConfig.ixx.
References CollisionConfig and layerId.
Referenced by layerId.
onSolidCollision()
| inline |
Adds a collision behavior for a specific layer.
- Parameters
-
otherLayerId The layer to respond to.
collisionBehavior The behavior when colliding.
- Returns
Reference to this config for chaining.
Definition at line 152 of file CollisionConfig.ixx.
Reference CollisionConfig.
reportCollisions()
| inline |
Sets whether this entity reports collisions.
- Parameters
-
isCollisionReporter True to generate collision events.
- Returns
Reference to this config for chaining.
Definition at line 120 of file CollisionConfig.ixx.
Reference CollisionConfig.
solidCollisionMask()
| inline |
Sets the solid collision mask.
- Parameters
-
solidCollisionMask Bitmask of layers to collide with.
- Returns
Reference to this config for chaining.
Definition at line 136 of file CollisionConfig.ixx.
References CollisionConfig and solidCollisionMask.
Referenced by solidCollisionMask.
useBoundingBox()
| inline |
Adds AABB collider for bounding box collision.
- Returns
Reference to this config for chaining.
Definition at line 69 of file CollisionConfig.ixx.
Reference CollisionConfig.
Private Member Functions
ensureCollisionComponent()
| inline noexcept |
Validates CollisionComponent presence.
- Parameters
-
isAvailable Whether the component should exist.
Definition at line 39 of file CollisionConfig.ixx.
Private Member Attributes
gameObject_
|
Non-owning pointer to the target GameObject.
Definition at line 32 of file CollisionConfig.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.