A Modifier defining a point with a mass that attracts or repulses particles. More...
Public Member Functions | |
PointMass (Zone *zone=NULL, ModifierTrigger trigger=INSIDE_ZONE, float mass=1.0f, float minDistance=0.05f) | |
Constructor of PointMass. | |
void | setPosition (const Vector3D &pos) |
Sets the delta position from the position of the zone (or origin if no zone set). | |
void | setMass (float mass) |
Sets the mass of this PointMass. | |
void | setMinDistance (float minDistance) |
Sets the minimum distance of this PointMass. | |
const Vector3D & | getPosition () const |
Gets the delta position. | |
const Vector3D & | getTransformedPosition () const |
Gets the transformed delta position. | |
float | getMass () const |
Gets the mass of this PointMass. | |
float | getMinDistance () const |
Gets the minimum distance of this PointMass. | |
Static Public Member Functions | |
static PointMass * | create (Zone *zone=NULL, ModifierTrigger trigger=INSIDE_ZONE, float mass=1.0f, float minDistance=0.05f) |
Creates and registers a new PointMass. | |
Protected Member Functions | |
virtual void | innerUpdateTransform () |
Updates all the parameters in the world coordinates. |
A Modifier defining a point with a mass that attracts or repulses particles.
A PointMass triggered on a Particle will affect its velocity as followed :
dist = pointMassPosition - particlePosition
particleVelocity += dist * mass * step / max(minDistance,|dist|)
Definition at line 38 of file SPK_PointMass.h.
PointMass | ( | Zone * | zone = NULL , |
|
ModifierTrigger | trigger = INSIDE_ZONE , |
|||
float | mass = 1.0f , |
|||
float | minDistance = 0.05f | |||
) |
PointMass * create | ( | Zone * | zone = NULL , |
|
ModifierTrigger | trigger = INSIDE_ZONE , |
|||
float | mass = 1.0f , |
|||
float | minDistance = 0.05f | |||
) | [static] |
Creates and registers a new PointMass.
zone | : the Zone of the PointMass | |
trigger | : the trigger of the PointMass | |
mass | : the mass of the PointMass | |
minDistance | : the minimum distance of the PointMass |
Definition at line 148 of file SPK_PointMass.h.
float getMass | ( | ) | const |
Gets the mass of this PointMass.
Definition at line 182 of file SPK_PointMass.h.
float getMinDistance | ( | ) | const |
Gets the minimum distance of this PointMass.
Definition at line 187 of file SPK_PointMass.h.
const Vector3D & getPosition | ( | ) | const |
Gets the delta position.
Definition at line 172 of file SPK_PointMass.h.
const Vector3D & getTransformedPosition | ( | ) | const |
Gets the transformed delta position.
Definition at line 177 of file SPK_PointMass.h.
void innerUpdateTransform | ( | ) | [protected, virtual] |
Updates all the parameters in the world coordinates.
This method can be overriden in derived classes of Transformable (By default it does nothing).
It is this method task to compute all parameters of the class that are dependent of the world transform.
Reimplemented from Transformable.
Definition at line 192 of file SPK_PointMass.h.
void setMass | ( | float | mass | ) |
Sets the mass of this PointMass.
The mass defines the strenght of the attraction. The more the mass, the stronger the attraction.
A position mass will result into an attraction while a negative mass will result into a repulsion. Moreover a mass equal to 0 make the PointMass have no effect.
mass | : the mass of this PointMass |
Definition at line 161 of file SPK_PointMass.h.
void setMinDistance | ( | float | minDistance | ) |
Sets the minimum distance of this PointMass.
The minimum distance of the PointMass is the minimum distance that can be considered to compute the force implied by the PointMass. If a distance between a Particle and a PointMass is inferior to the minimum distance of the PointMass, the distance is clamped to the minimum distance.
This avoids forces that approaching the infinity with Particle getting very close to the PointMass.
minDistance | : the minimum distance of this PointMass |
Definition at line 166 of file SPK_PointMass.h.
void setPosition | ( | const Vector3D & | pos | ) |
Sets the delta position from the position of the zone (or origin if no zone set).
pos | : the delta position |
Definition at line 155 of file SPK_PointMass.h.