Represents a world where collisions can happen. It does not have dynamics, for this you will need the DynamicsWorld.
More...
#include <CollisionWorld.hpp>
Represents a world where collisions can happen. It does not have dynamics, for this you will need the DynamicsWorld.
- See also
- DynamicsWorld
◆ CollisionWorld() [1/2]
stw::CollisionWorld::CollisionWorld |
( |
| ) |
|
◆ CollisionWorld() [2/2]
stw::CollisionWorld::CollisionWorld |
( |
std::unordered_map< std::uint64_t, CollisionBody * > | bodies, |
|
|
std::vector< Solver * > | solvers ) |
◆ AddCollisionBody()
void stw::CollisionWorld::AddCollisionBody |
( |
CollisionBody * | body | ) |
|
Adds a collision body to the world.
- Parameters
-
◆ AddSolver()
void stw::CollisionWorld::AddSolver |
( |
Solver * | solver | ) |
|
Adds a solver to the world.
- Parameters
-
◆ FindCollisions()
void stw::CollisionWorld::FindCollisions |
( |
std::uint64_t | firstId, |
|
|
std::uint64_t | secondId, |
|
|
std::vector< Collision > & | collisions, |
|
|
std::vector< Collision > & | triggers ) |
◆ RemoveCollisionBody()
void stw::CollisionWorld::RemoveCollisionBody |
( |
const CollisionBody * | body | ) |
|
Removes a collision body to the world.
- Parameters
-
◆ RemoveSolver()
void stw::CollisionWorld::RemoveSolver |
( |
Solver * | solver | ) |
|
Removes the solver from the world.
- Parameters
-
◆ ResolveCollisions()
void stw::CollisionWorld::ResolveCollisions |
( |
float | deltaTime | ) |
|
Resolves all the collisions that happened in this world.
- Parameters
-
deltaTime | Time elapsed since the last frame. |
◆ SendCollisionCallbacks()
void stw::CollisionWorld::SendCollisionCallbacks |
( |
std::vector< Collision > & | collisions, |
|
|
float | deltaTime ) const |
Calls the callbacks of all the bodies in each collisions.
- Parameters
-
collisions | Collisions to send callback from. |
deltaTime | Time elapsed since the last frame. |
◆ SetCollisionCallback()
void stw::CollisionWorld::SetCollisionCallback |
( |
const std::function< void(Collision &, float)> & | callback | ) |
|
Sets the collision callback of this world.
- Parameters
-
◆ SolveCollisions()
void stw::CollisionWorld::SolveCollisions |
( |
const std::vector< Collision > & | collisions, |
|
|
float | deltaTime ) const |
Solves the collisions with the provided solvers.
- Parameters
-
collisions | Collisions to solve. |
deltaTime | Time elapsed since the last frame. |
◆ _bodies
std::unordered_map<std::uint64_t, CollisionBody*> stw::CollisionWorld::_bodies |
|
protected |
◆ _grid
◆ _onCollision
std::function<void(Collision&, float) stw::CollisionWorld::_onCollision) |
|
protected |
◆ _solvers
std::vector<Solver*> stw::CollisionWorld::_solvers |
|
protected |
◆ useSpacePartitioning
bool stw::CollisionWorld::useSpacePartitioning = true |
The documentation for this class was generated from the following files: