Applies a translational acceleration to particles over time. More...
Public Types | |
typedef std::tr1::shared_ptr < ForceAffector > | Ptr |
Shared pointer type referring to AccelerationAffector objects. | |
Static Public Member Functions | |
static Ptr | Create (sf::Vector2f acceleration) |
Creates an affector that accelerates particles continuously. | |
Public Member Functions | |
ForceAffector (sf::Vector2f acceleration) | |
Constructor. | |
virtual void | Affect (Particle &particle, float dt) |
Affects particles. | |
void | SetAcceleration (sf::Vector2f acceleration) |
Sets the linear acceleration applied to the particles. | |
sf::Vector2f | GetAcceleration () const |
Returns the linear acceleration applied to the particles (in degrees). |
Applies a translational acceleration to particles over time.
Affector class that applies an acceleration vector to each particle. A popular use case is gravity.
thor::ForceAffector::ForceAffector | ( | sf::Vector2f | acceleration | ) | [explicit] |
Constructor.
acceleration | The acceleration vector. The particle's velocity changes by this vector each second. |
virtual void thor::ForceAffector::Affect | ( | Particle & | particle, |
float | dt | ||
) | [virtual] |
Affects particles.
particle | The particle currently being affected. |
dt | Time interval during which particles are affected. |
Implements thor::Affector.
static Ptr thor::ForceAffector::Create | ( | sf::Vector2f | acceleration | ) | [static] |
Creates an affector that accelerates particles continuously.
acceleration | The acceleration vector. The particle's velocity changes by this vector each second. |