A model for physics simulation.
More...
#include <gf/PhysicsModel.h>
A model for physics simulation.
- See also
- gf::PhysicsBody, gf::FixedTimestepModel
gf::PhysicsModel::PhysicsModel |
( |
Vector2f |
gravity = {0.0f, 0.0f} | ) |
|
Constructor.
- Parameters
-
gravity | The gravity of the simulation (default: no gravity) |
Add a body to the simulation.
- Parameters
-
void gf::PhysicsModel::clear |
( |
| ) |
|
Remove all bodies from the simulation.
Vector2f gf::PhysicsModel::getGravity |
( |
| ) |
const |
|
inlinenoexcept |
Get the gravity of the simulation.
- Returns
- The current gravity
void gf::PhysicsModel::removeBody |
( |
PhysicsBody & |
body | ) |
|
Remove a body from the simulation.
- Parameters
-
void gf::PhysicsModel::setGravity |
( |
Vector2f |
gravity | ) |
|
|
inlinenoexcept |
Set the gravity of the simulation.
- Parameters
-
virtual void gf::PhysicsModel::update |
( |
float |
dt | ) |
|
|
overridevirtual |
Update the model's state.
Models are updated each frame. The time between two frames is given as a parameter to help in the update. This time is in seconds.
- Parameters
-
dt | The time (in seconds) since the last update |
- See also
- gf::ModelContainer::update()
Reimplemented from gf::Model.