Skip to main content

HitPolicy.ixx File

Defines collision hit policies controlling how many collisions are reported per frame. More...

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacemodules

Domain-specific components and systems. More...

namespacephysics

Physics simulation and collision detection subsystem for the game engine. More...

namespacecollision
namespacetypes

Type definitions for collision system behavior configuration. More...

Description

Defines collision hit policies controlling how many collisions are reported per frame.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file HitPolicy.ixx
3 * @brief Defines collision hit policies controlling how many collisions are reported per frame.
4 */
5module;
6
7
8export module helios.engine.modules.physics.collision.types.HitPolicy;
9
10
12
13 /**
14 * @brief Specifies how many collision events an entity can receive per frame.
15 *
16 * @details HitPolicy controls the collision detection behavior when an entity
17 * overlaps multiple other entities in the same frame. This affects both
18 * performance and gameplay logic.
19 *
20 * ## Policies
21 *
22 * | Policy | Behavior |
23 * |--------|----------|
24 * | `OneHit` | Reports only the first collision detected (default) |
25 * | `All` | Reports all collisions with overlapping entities |
26 *
27 * ## Use Cases
28 *
29 * - **OneHit:** Projectiles that destroy on first contact, pickups collected once
30 * - **All:** Area-of-effect damage, entities affecting multiple targets simultaneously
31 *
32 * ## Usage
33 *
34 * ```cpp
35 * // Projectile: stops after first hit
36 * prototype.withCollision([](CollisionBuilder& b) {
37 * b.collision()
38 * .layer(Layers::PROJECTILE)
39 * .hitPolicy(HitPolicy::OneHit);
40 * });
41 *
42 * // Explosion: damages all entities in range
43 * prototype.withCollision([](CollisionBuilder& b) {
44 * b.collision()
45 * .layer(Layers::EXPLOSION)
46 * .hitPolicy(HitPolicy::All);
47 * });
48 * ```
49 *
50 * @see CollisionComponent::setHitPolicy
51 * @see GridCollisionDetectionSystem
52 */
53 enum class HitPolicy {
54
55 /**
56 * @brief Reports only the first collision per frame.
57 *
58 * @details Once a collision is detected, the entity skips further
59 * collision checks for the current frame. This is the default policy
60 * and provides optimal performance for typical projectile behavior.
61 */
63
64 /**
65 * @brief Reports all collisions with overlapping entities.
66 *
67 * @details The entity continues collision checks even after detecting
68 * a collision, generating events for every overlapping entity. Use for
69 * area-of-effect or multi-target interactions.
70 */
72
73 };
74
75
76}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.