A model for physics simulation.
More...
#include <gf/PhysicsModel.h>
A model for physics simulation.
- See also
- gf::PhysicsBody, gf::FixedTimestepModel
◆ PhysicsModel()
gf::PhysicsModel::PhysicsModel |
( |
Vector2f |
gravity = { 0.0f, 0.0f } | ) |
|
Constructor.
- Parameters
-
gravity | The gravity of the simulation (default: no gravity) |
◆ addBody()
Add a body to the simulation.
- Parameters
-
◆ clear()
void gf::PhysicsModel::clear |
( |
| ) |
|
Remove all bodies from the simulation.
◆ getGravity()
Vector2f gf::PhysicsModel::getGravity |
( |
| ) |
const |
|
inlinenoexcept |
Get the gravity of the simulation.
- Returns
- The current gravity
◆ removeBody()
void gf::PhysicsModel::removeBody |
( |
PhysicsBody & |
body | ) |
|
Remove a body from the simulation.
- Parameters
-
◆ setGravity()
void gf::PhysicsModel::setGravity |
( |
Vector2f |
gravity | ) |
|
|
inlinenoexcept |
Set the gravity of the simulation.
- Parameters
-
◆ update()
virtual void gf::PhysicsModel::update |
( |
Time |
time | ) |
|
|
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
-
time | The time since the last update |
- See also
- gf::ModelContainer::update()
Reimplemented from gf::Model.