hx3d
1
2D/3D Simple Game Framework
|
Physical world. Manages colliders and attractors. More...
#include <world.hpp>
Public Member Functions | |
World (const glm::vec2 globalGravity={0,-9.81}, const unsigned int iterations=10, const float physRatio=10.f) | |
Create a world with a global gravity, iterations and the physical ratio. More... | |
void | addAttractor (const Ptr< Attractor > &attractor) |
Add an attractor. More... | |
void | addListener (const Ptr< CollisionListener > &listener) |
Add a collision listener. More... | |
void | addCollider (const Ptr< Collider > &collider) |
Add a collider. More... | |
void | removeCollider (const Ptr< Collider > &collider) |
Remove a collider. More... | |
void | step (float dt=1.f/60.f) |
Step the physical simulation. More... | |
void | render (graphics::BaseBatch &batch) |
Render a debug view of the physical simulation. More... | |
float | getPhysRatio () const |
Get the physical ratio. More... | |
const Ptr< GlobalAttractor > | getGlobalGravity () |
Get the global attractor. More... | |
CollisionMatrix & | getCollisionMatrix () |
Get the collision matrix. More... | |
hx3d::physics2d::World::World | ( | const glm::vec2 | globalGravity = {0, -9.81} , |
const unsigned int | iterations = 10 , |
||
const float | physRatio = 10.f |
||
) |
void hx3d::physics2d::World::addListener | ( | const Ptr< CollisionListener > & | listener | ) |
CollisionMatrix & hx3d::physics2d::World::getCollisionMatrix | ( | ) |
const Ptr< GlobalAttractor > hx3d::physics2d::World::getGlobalGravity | ( | ) |
float hx3d::physics2d::World::getPhysRatio | ( | ) | const |
void hx3d::physics2d::World::render | ( | graphics::BaseBatch & | batch | ) |
void hx3d::physics2d::World::step | ( | float | dt = 1.f/60.f | ) |