Packageorg.flintparticles.twoD.actions
Classpublic class Collide
InheritanceCollide Inheritance ActionBase Inheritance Object
Implements FrameUpdatable

The Collide action detects collisions between particles and modifies their velocities in response to the collision. All particles are approximated to a circular shape for the collisions and they are assumed to be of even density.

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.



Public Properties
 PropertyDefined By
  bounce : Number
The coefficient of restitution when the particles collide.
Collide
 Inheritedpriority : int
Returns a default priority of 0 for this action.
ActionBase
Protected Properties
 PropertyDefined By
 Inherited_priority : int = 0
ActionBase
Public Methods
 MethodDefined 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
  
[override] Removes the UpdateOnFrame activity that was added to the emitter in the addedToEmitter method.
Collide
  
update(emitter:Emitter, particle:Particle, time:Number):void
[override] Causes the particle to check for collisions against all other particles.
Collide
Property Detail
bounceproperty
bounce:Number

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 particles to gain energy in the collision.


Implementation
    public function get bounce():Number
    public function set bounce(value:Number):void
Constructor Detail
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.

Parameters
bounce: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

Method Detail
addedToEmitter()method
override public function addedToEmitter(emitter:Emitter):void

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.

Parameters

emitter:Emitter — The emitter this action has been added to.

See also

frameUpdate()method 
public function 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.

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):void

Removes 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):void

Causes 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