types Namespace
Type definitions for collision system behavior configuration. More...
Definition
Classes Index
| struct | CollisionContext |
|
Context data describing a collision event. More... | |
Typedefs Index
| using | CollisionLayer = uint32_t |
|
Type alias for collision layer identifiers. More... | |
Enumerations Index
| enum class | CollisionBehavior : uint16_t { ... } |
|
Defines how an entity responds to a collision event. More... | |
| enum class | CollisionResponse : uint8_t { ... } |
|
Defines how an entity responds to a collision event. More... | |
| enum class | HitPolicy { ... } |
|
Specifies how many collision events an entity can receive per frame. More... | |
Operators Index
| constexpr CollisionBehavior | operator| (CollisionBehavior lhs, CollisionBehavior rhs) noexcept |
|
Combines two CollisionBehavior flags using bitwise OR. More... | |
| constexpr CollisionBehavior | operator& (CollisionBehavior lhs, CollisionBehavior rhs) noexcept |
|
Masks two CollisionBehavior flags using bitwise AND. More... | |
Functions Index
| constexpr bool | hasFlag (const CollisionBehavior mask, const CollisionBehavior flag) noexcept |
|
Checks if a behavior mask contains a specific flag. More... | |
Variables Index
| constexpr size_t | CollisionBehaviorItemSize = 8 |
|
Number of distinct CollisionBehavior flags. More... | |
| constexpr std::size_t | MAX_COLLISION_LAYERS = std::numeric_limits<CollisionLayer>::digits |
|
Maximum number of distinct collision layers. More... | |
Description
Type definitions for collision system behavior configuration.
Provides enums and structs that configure collision detection and response behavior, including bitmask-based behavior flags and collision event context data.
Typedefs
CollisionLayer
|
Type alias for collision layer identifiers.
Collision layers are represented as bitmask values where each layer is a single bit. This allows efficient layer masking operations.
Definition at line 22 of file CollisionLayer.ixx.
Enumerations
CollisionBehavior
| strong |
Defines how an entity responds to a collision event.
- Enumeration values
CollisionBehavior values are used as bitmasks to configure per-layer collision responses in CollisionComponent. Multiple behaviors can be combined using bitwise operations.
The behavior determines what action the collision system takes when two entities collide based on their layer configuration.
Not all behaviors are currently fully implemented. Currently supported:
- `Reflect` - Fully supported
- `Bounce` - Fully supported
- `Despawn` - Fully supported
Definition at line 30 of file CollisionBehavior.ixx.
CollisionResponse
| strong |
Defines how an entity responds to a collision event.
- Enumeration values
CollisionResponse is a bitmask enum that specifies the behavior when a collision is detected.
- See Also
CollisionComponent
Definition at line 23 of file CollisionResponse.ixx.
HitPolicy
| strong |
Specifies how many collision events an entity can receive per frame.
- Enumeration values
-
OneHit Reports only the first collision per frame All Reports all collisions with overlapping entities
HitPolicy controls the collision detection behavior when an entity overlaps multiple other entities in the same frame. This affects both performance and gameplay logic.
## Policies
| Policy | Behavior | |--------|----------| | `OneHit` | Reports only the first collision detected (default) | | `All` | Reports all collisions with overlapping entities |
## Use Cases
- **OneHit:** Projectiles that destroy on first contact, pickups collected once
- **All:** Area-of-effect damage, entities affecting multiple targets simultaneously
## Usage
```cpp // Projectile: stops after first hit prototype.withCollision([](CollisionBuilder& b) { b.collision() .layer(Layers::PROJECTILE) .hitPolicy(HitPolicy::OneHit); });
// Explosion: damages all entities in range prototype.withCollision([](CollisionBuilder& b) { b.collision() .layer(Layers::EXPLOSION) .hitPolicy(HitPolicy::All); }); ```
- See Also
CollisionComponent::setHitPolicy
- See Also
GridCollisionDetectionSystem
Definition at line 53 of file HitPolicy.ixx.
Operators
operator&()
| nodiscard constexpr noexcept |
Masks two CollisionBehavior flags using bitwise AND.
- Parameters
-
lhs Left-hand side behavior.
rhs Right-hand side behavior.
- Returns
Masked behavior flags.
Definition at line 121 of file CollisionBehavior.ixx.
operator|()
| nodiscard constexpr noexcept |
Combines two CollisionBehavior flags using bitwise OR.
- Parameters
-
lhs Left-hand side behavior.
rhs Right-hand side behavior.
- Returns
Combined behavior flags.
Definition at line 107 of file CollisionBehavior.ixx.
Functions
hasFlag()
| nodiscard constexpr noexcept |
Checks if a behavior mask contains a specific flag.
- Parameters
-
mask The behavior mask to check.
flag The flag to test for.
- Returns
True if the mask contains the flag, false otherwise.
Definition at line 135 of file CollisionBehavior.ixx.
Referenced by helios::engine::modules::physics::collision::systems::CollisionStateResponseSystem::update.
Variables
CollisionBehaviorItemSize
| constexpr |
Number of distinct CollisionBehavior flags.
Definition at line 97 of file CollisionBehavior.ixx.
MAX_COLLISION_LAYERS
| constexpr |
Maximum number of distinct collision layers.
Derived from the number of bits in CollisionLayer (32 for uint32_t).
Definition at line 29 of file CollisionLayer.ixx.
The documentation for this namespace was generated from the following files:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.