| Package | org.flintparticles.twoD.actions |
| Class | public class MutualGravity |
| Inheritance | MutualGravity ActionBase Object |
This action has a priority of 10, so that it executes before other actions.
| Property | Defined By | ||
|---|---|---|---|
| epsilon : Number
The minimum distance for which the gravity force is calculated. | MutualGravity | ||
| maxDistance : Number
The maximum distance between particles for the gravitational
effect to be calculated. | MutualGravity | ||
| power : Number
The strength of the gravity force. | MutualGravity | ||
![]() | priority : int
Returns a default priority of 0 for this action. | ActionBase | |
| Method | Defined By | ||
|---|---|---|---|
MutualGravity(power:Number = 0, maxDistance:Number = 0, epsilon:Number = 1)
The constructor creates a MutualGravity action for use by an emitter. | MutualGravity | ||
addedToEmitter(emitter:Emitter):void [override]
Instructs the emitter to produce a sorted particle array for optimizing
the calculations in the update method of this action. | MutualGravity | ||
![]() | removedFromEmitter(emitter:Emitter):void
This method does nothing. | ActionBase | |
[override]
Checks all particles near the current particle and applies the
gravity force between them. | MutualGravity | ||
| epsilon | property |
epsilon:NumberThe minimum distance for which the gravity force is calculated. Particles closer than this distance experience the gravity as it they were this distance away. This stops the gravity effect blowing up as distances get very small.
public function get epsilon():Number public function set epsilon(value:Number):void| maxDistance | property |
maxDistance:NumberThe maximum distance between particles for the gravitational effect to be calculated. You can sometimes speed up the calculation of this action by reducing the maxDistance since often only the closest other particles have a significant effect on the motion of a particle.
public function get maxDistance():Number public function set maxDistance(value:Number):void| power | property |
power:NumberThe strength of the gravity force.
public function get power():Number public function set power(value:Number):void| MutualGravity | () | Constructor |
public function MutualGravity(power:Number = 0, maxDistance:Number = 0, epsilon:Number = 1)The constructor creates a MutualGravity action for use by an emitter. To add a MutualGravity to all particles created by an emitter, use the emitter's addAction method.
Parameterspower:Number (default = 0) — The strength of the gravitational pull between the
particles.
| |
maxDistance:Number (default = 0) — The maximum distance between particles for the
gravitational effect to be calculated. You can sometimes speed up
the calculation of this action by
reducing the maxDistance since often only the closest other particles
have a significant effect on the motion of a particle.
| |
epsilon:Number (default = 1) — The minimum distance for which gravity is calculated.
Particles closer than this distance experience a gravity force as if
they were this distance away. This stops the gravity effect blowing
up as distances get small.
|
See also
| addedToEmitter | () | method |
override public function addedToEmitter(emitter:Emitter):voidInstructs the emitter to produce a sorted particle array for optimizing the calculations in the update method of this action.
Parameters
emitter:Emitter — The emitter this action has been added to.
|
See also
| update | () | method |
override public function update(emitter:Emitter, particle:Particle, time:Number):voidChecks all particles near the current particle and applies the gravity force between them.
This method is called by the emitter and need not be called by the user.
Parameters
emitter:Emitter — The Emitter that created the particle.
| |
particle:Particle — The particle to be updated.
| |
time:Number — The duration of the frame - used for time based updates.
|
See also