Stowy Physics Engine 0.1.0
|
A world with dynamics in it. More...
#include <DynamicsWorld.hpp>
Public Member Functions | |
void | AddRigidbody (Rigidbody *rigidbody) |
Adds a rigidbody in the world. | |
void | ApplyGravity () const |
Applies the gravity to all the rigidbody. | |
void | MoveBodies (float deltaTime) const |
Moves all the rigidbodies. | |
void | Step (float deltaTime) |
Steps the world. | |
void | SetWorldGravity (Vector2 gravity) |
Sets the gravity in the world. | |
![]() | |
CollisionWorld () | |
CollisionWorld (std::unordered_map< std::uint64_t, CollisionBody * > bodies, std::vector< Solver * > solvers) | |
void | AddCollisionBody (CollisionBody *body) |
Adds a collision body to the world. | |
void | RemoveCollisionBody (const CollisionBody *body) |
Removes a collision body to the world. | |
void | AddSolver (Solver *solver) |
Adds a solver to the world. | |
void | RemoveSolver (Solver *solver) |
Removes the solver from the world. | |
void | SetCollisionCallback (const std::function< void(Collision &, float)> &callback) |
Sets the collision callback of this world. | |
void | SolveCollisions (const std::vector< Collision > &collisions, float deltaTime) const |
Solves the collisions with the provided solvers. | |
void | SendCollisionCallbacks (std::vector< Collision > &collisions, float deltaTime) const |
Calls the callbacks of all the bodies in each collisions. | |
void | ResolveCollisions (float deltaTime) |
Resolves all the collisions that happened in this world. | |
void | FindCollisions (std::uint64_t firstId, std::uint64_t secondId, std::vector< Collision > &collisions, std::vector< Collision > &triggers) |
Additional Inherited Members | |
![]() | |
bool | useSpacePartitioning = true |
![]() | |
std::unordered_map< std::uint64_t, CollisionBody * > | _bodies |
std::vector< Solver * > | _solvers |
BroadPhaseGrid | _grid |
std::function< void(Collision &, float) | _onCollision ) |
A world with dynamics in it.
void stw::DynamicsWorld::AddRigidbody | ( | Rigidbody * | rigidbody | ) |
Adds a rigidbody in the world.
rigidbody | Rigidbody to add. |
void stw::DynamicsWorld::ApplyGravity | ( | ) | const |
Applies the gravity to all the rigidbody.
void stw::DynamicsWorld::MoveBodies | ( | float | deltaTime | ) | const |
Moves all the rigidbodies.
deltaTime | Time elapsed since the last frame. |
void stw::DynamicsWorld::SetWorldGravity | ( | Vector2 | gravity | ) |
Sets the gravity in the world.
gravity | Gravity to set. |
void stw::DynamicsWorld::Step | ( | float | deltaTime | ) |
Steps the world.
deltaTime | Time elapsed since the last frame. |