Detects overlapping colliders with a uniform spatial hash grid.
More...
#include <systems/ColliderSystem.hpp>
|
| | ColliderSystem (rtk::collision::CollisionBuffer &collisionBuffer, float cellSize, busEvent &eventBus) |
| | Creates the system.
|
| |
|
void | onStart (rtk::ecs::Registry &) override |
| | Logs that the system is loaded.
|
| |
| void | update (rtk::ecs::Registry ®istry, float) override |
| | Rebuilds the grid and reports every overlapping pair.
|
| |
|
void | onStop (rtk::ecs::Registry &) override |
| | Clears the grid and the collision buffer.
|
| |
Detects overlapping colliders with a uniform spatial hash grid.
Each pair is reported once per frame in the CollisionBuffer and as a rtk::collision::Collision event, if each collider mask accepts the other collider layer.
◆ ColliderSystem()
Creates the system.
- Parameters
-
| collisionBuffer | Buffer filled with the collisions of each frame. |
| cellSize | Side of a grid cell, in pixels. |
| eventBus | Bus on which collisions are published. |
◆ update()
| void rtk::systems::ColliderSystem::update |
( |
rtk::ecs::Registry & | registry, |
|
|
float | ) |
|
inlineoverride |
Rebuilds the grid and reports every overlapping pair.
- Parameters
-
| registry | Registry holding the colliders. |