supertux
|
Physics engine. More...
#include <physic.hpp>
Public Member Functions | |
void | reset () |
Resets all velocities and accelerations to 0. | |
void | set_velocity (float nvx, float nvy) |
Sets velocity to a fixed value. | |
void | set_velocity (const Vector &vector) |
void | set_velocity_x (float nvx) |
void | set_velocity_y (float nvy) |
void | inverse_velocity_x () |
Velocity inversion. | |
void | inverse_velocity_y () |
Vector | get_velocity () const |
float | get_velocity_x () const |
float | get_velocity_y () const |
void | set_acceleration (float nax, float nay) |
Set acceleration. More... | |
void | set_acceleration (const Vector &vector) |
void | set_acceleration_x (float nax) |
void | set_acceleration_y (float nay) |
Vector | get_acceleration () const |
float | get_acceleration_x () const |
float | get_acceleration_y () const |
void | enable_gravity (bool enable) |
Enables or disables handling of gravity. | |
bool | gravity_enabled () const |
void | set_gravity_modifier (float modifier) |
Set gravity modifier factor to apply to object when enabled. | |
float | get_gravity_modifier () const |
Vector | get_movement (float dt_sec) |
Physics engine.
This is a very simplistic physics engine handling accelerated and constant movement along with gravity.
void Physic::set_acceleration | ( | float | nax, |
float | nay | ||
) |
Set acceleration.
Sets acceleration applied to the object. (Note that gravity is eventually added to the vertical acceleration)