|
Stowy Physics Engine 0.1.0
|
A grid in which the physical object are placed in. This is used to optimize performance by only checking collision with colliders that are in the same cell. More...
#include <BroadPhaseGrid.hpp>
Public Member Functions | |
| BroadPhaseGrid (float minX, float maxX, float minY, float maxY, float cellSize) | |
| Constructs a new grid. | |
| void | Update (const std::unordered_map< std::uint64_t, CollisionBody * > &bodies) |
| Updates the layout of the grid. | |
| std::vector< std::pair< std::uint64_t, std::uint64_t > > | GetCollisionPairs () const |
| Find all the pair of objects that are in the same cell. Doesn't contain any duplicates. | |
A grid in which the physical object are placed in. This is used to optimize performance by only checking collision with colliders that are in the same cell.
A collider that spans on multiple cells will have a pointer on every cell.
| stw::BroadPhaseGrid::BroadPhaseGrid | ( | float | minX, |
| float | maxX, | ||
| float | minY, | ||
| float | maxY, | ||
| float | cellSize ) |
Constructs a new grid.
| minX | X coordinate on the bottom left point of the grid. |
| maxX | X coordinate on the top right point of the grid. |
| minY | Y coordinate on the bottom left point of the grid. |
| maxY | Y coordinate on the top right point of the grid. |
| cellSize | Size (in meter) of a cell. |
| std::vector< std::pair< std::uint64_t, std::uint64_t > > stw::BroadPhaseGrid::GetCollisionPairs | ( | ) | const |
Find all the pair of objects that are in the same cell. Doesn't contain any duplicates.
| void stw::BroadPhaseGrid::Update | ( | const std::unordered_map< std::uint64_t, CollisionBody * > & | bodies | ) |
Updates the layout of the grid.
| bodies | Bodies in the physical world. |