| Package | org.flintparticles.twoD.actions |
| Class | public class Collide |
| Inheritance | Collide ActionBase Object |
| Implements | FrameUpdatable |
If the particles reach a stationary, or near stationary, state under an accelerating force (e.g. gravity) then they will fall through each other. This is due to the nature of the alogorithm used, which is designed for speed of execution and sufficient accuracy when the particles are in motion, not for absolute precision.
This action has a priority of -20, so that it executes after other actions.
| Property | Defined By | ||
|---|---|---|---|
| bounce : Number
The coefficient of restitution when the particles collide. | Collide | ||
![]() | priority : int
Returns a default priority of 0 for this action. | ActionBase | |
| Method | Defined By | ||
|---|---|---|---|
Collide(bounce:Number = 1)
The constructor creates a Collide action for use by an emitter. | Collide | ||
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 and
adds an UpdateOnFrame activity to the emitter to call this objects
frameUpdate method once per frame. | Collide | ||
frameUpdate(emitter:Emitter, time:Number):void
Called every frame before the particles are updated, this method
calculates the collision radius of the largest two particles, which
aids in optimizing the collision calculations. | Collide | ||
removedFromEmitter(emitter:Emitter):void [override]
Removes the UpdateOnFrame activity that was added to the emitter in the
addedToEmitter method. | Collide | ||
[override]
Causes the particle to check for collisions against all other particles. | Collide | ||
| bounce | property |
bounce:NumberThe coefficient of restitution when the particles collide. A value of 1 gives a pure elastic collision, with no energy loss. A value between 0 and 1 causes the particles to loose enegy in the collision. A value greater than 1 causes the particles to gain energy in the collision.
public function get bounce():Number public function set bounce(value:Number):void| Collide | () | Constructor |
public function Collide(bounce:Number = 1)The constructor creates a Collide action for use by an emitter. To add a Collide to all particles created by an emitter, use the emitter's addAction method.
Parametersbounce:Number (default = 1) — The coefficient of restitution when the particles collide.
A value of 1 gives a pure elastic collision, with no energy loss. A
value between 0 and 1 causes the particles to loose enegy in the
collision. A value greater than 1 causes the particle to gain energy
in the collision.
|
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 and adds an UpdateOnFrame activity to the emitter to call this objects frameUpdate method once per frame.
Parameters
emitter:Emitter — The emitter this action has been added to.
|
See also
| frameUpdate | () | method |
public function frameUpdate(emitter:Emitter, time:Number):voidCalled every frame before the particles are updated, this method calculates the collision radius of the largest two particles, which aids in optimizing the collision calculations.
This method is called using an UpdateOnFrame activity that is created in the addedToEmitter method.
Parameters
emitter:Emitter — The emitter that is using this action.
| |
time:Number — The duration of the current animation frame.
|
See also
| removedFromEmitter | () | method |
override public function removedFromEmitter(emitter:Emitter):voidRemoves the UpdateOnFrame activity that was added to the emitter in the addedToEmitter method.
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):voidCauses the particle to check for collisions against all other particles.
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