AxisSpawnPlacer Class
Spawn placer that distributes entities evenly along an axis. More...
Declaration
Base class
| class | SpawnPlacer |
|
Abstract interface for determining spawn positions. More... | |
Public Constructors Index
| AxisSpawnPlacer (const helios::math::vec3f axis, const helios::math::vec3f origin) | |
|
Constructs an AxisSpawnPlacer with axis and origin. More... | |
Public Member Functions Index
| helios::math::vec3f | getPosition (const helios::engine::ecs::EntityHandle &entityHandle, const helios::math::aabbf &gameObjectBounds, const helios::math::aabbf &environmentBounds, const SpawnPlanCursor &cursor, const SpawnContext &spawnContext) override |
|
Calculates spawn position along the axis. More... | |
Private Member Attributes Index
| helios::math::vec3f | axis_ |
|
Normalized direction vector defining the spawn axis. More... | |
| helios::math::vec3f | origin_ {} |
|
Starting point for entity placement. More... | |
Description
Spawn placer that distributes entities evenly along an axis.
AxisSpawnPlacer positions spawned entities along a normalized direction vector starting from an origin point. Entities are distributed evenly between the origin and the environment boundary intersection.
## Positioning Algorithm
1. Calculates where the axis intersects the environment bounds 2. Computes available length accounting for entity size 3. Distributes entities evenly along this length based on cursor position
## Use Cases
- **Formation spawning:** Line formations of enemies
- **Wave patterns:** Entities spawning along a direction
- **Corridor spawning:** Entities placed along a path
## Usage
```cpp // Spawn entities along positive X-axis from origin auto placer = std::make_unique<AxisSpawnPlacer>( helios::math::vec3f{1.0f, 0.0f, 0.0f}, // axis (normalized) helios::math::vec3f{-100.0f, 0.0f, 0.0f} // origin );
// With 5 entities: evenly spaced from origin to right boundary ```
The axis vector must be normalized.
The origin must be within the environment bounds.
- See Also
- See Also
Definition at line 61 of file AxisSpawnPlacer.ixx.
Public Constructors
AxisSpawnPlacer()
| inline explicit |
Constructs an AxisSpawnPlacer with axis and origin.
- Parameters
-
axis Normalized direction vector for entity distribution.
origin Starting point for the axis within environment bounds.
- Precondition
`axis` must be normalized.
Definition at line 83 of file AxisSpawnPlacer.ixx.
Reference helios::math::vec3< T >::isNormalized.
Public Member Functions
getPosition()
| inline virtual |
Calculates spawn position along the axis.
Distributes entities evenly along the axis from origin to the environment boundary. Uses the cursor position to determine placement within the available range.
- Parameters
-
guid Unique identifier of the entity (unused).
gameObjectBounds Bounding box of the entity being spawned.
environmentBounds Bounding box of the spawn environment.
cursor Current spawn batch cursor with position and count.
spawnContext Context for the spawn operation (unused).
- Returns
World position for the spawned entity.
- Precondition
Origin must be within environment bounds.
Definition at line 105 of file AxisSpawnPlacer.ixx.
References helios::math::aabb< T >::contains, helios::math::aabb< T >::max, helios::math::aabb< T >::min, helios::engine::runtime::spawn::SpawnPlanCursor::position, helios::math::aabb< T >::size, helios::engine::runtime::spawn::SpawnPlanCursor::spawnCount and helios::math::aabb< T >::translate.
Private Member Attributes
axis_
|
Normalized direction vector defining the spawn axis.
Definition at line 66 of file AxisSpawnPlacer.ixx.
origin_
|
Starting point for entity placement.
Definition at line 71 of file AxisSpawnPlacer.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.