| Package | org.flintparticles.twoD.actions |
| Class | public class MutualGravity |
| Inheritance | MutualGravity ActionBase |
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
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 | |
|
Checks all particles near the current particle and applies the
gravity force between them.
| MutualGravity | ||
| epsilon | property |
epsilon:Number [read-write]The 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.
Implementation public function get epsilon():Number
public function set epsilon(value:Number):void
| maxDistance | property |
maxDistance:Number [read-write]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.
Implementation public function get maxDistance():Number
public function set maxDistance(value:Number):void
| power | property |
power:Number [read-write]The strength of the gravity force.
Implementation 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 |
public override function addedToEmitter(emitter:Emitter):voidInstructs the emitter to produce a sorted particle array for optimizing the calculations in the update method of this action.
Parametersemitter:Emitter — The emitter this action has been added to.
|
See also
| update | () | method |
public override 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.
Parametersemitter: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