supertux
Public Member Functions | List of all members
Physic Class Referencefinal

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)
 

Detailed Description

Physics engine.

This is a very simplistic physics engine handling accelerated and constant movement along with gravity.

Member Function Documentation

◆ set_acceleration()

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)


The documentation for this class was generated from the following files: