Packageorg.flintparticles.actions
Classpublic class Collide
InheritanceCollide Inheritance Action

The Collide action detects collisions between particles and modifies their velocities in response to the collision. All paticles are approximated to a circular shape for the collisions and they are assumed to be off equal 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.



Public Properties
 PropertyDefined by
  bounce : Number
The coefficient of restitution when the particles collide.
Collide
  radius : Number
The radius of a particle used when calculating the collisions.
Collide
Public Methods
 MethodDefined by
  
Collide(radius:Number, bounce:Number = 1)
The constructor creates a Collide action for use by an emitter.
Collide
  
addedToEmitter(emitter:Emitter):void
The addedToEmitter method is called by the emitter when the Action is added to it It is called within the emitter's addAction method and need not be called by the user.
Collide
  
The getDefaultPriority method is used to order the execution of actions.
Collide
 Inherited
The removedFromEmitter method is called by the emitter when the Action is removed from it It is called within the emitter's removeAction method and need not be called by the user.
Action
  
update(emitter:Emitter, particle:Particle, time:Number):void
The update method is used by the emitter to apply the action to every particle.
Collide
Property detail
bounceproperty
bounce:Number  [read-write]

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 particle to loose enegy in the collision. A value greater than 1 causes the particle to gain energy in the collision.

Implementation
    public function get bounce():Number
    public function set bounce(value:Number):void
radiusproperty 
radius:Number  [read-write]

The radius of a particle used when calculating the collisions. this radius is multiplied by the scale property of each particle to get the particle's actual size and relative mass for calculating the collision and response.

Implementation
    public function get radius():Number
    public function set radius(value:Number):void
Constructor detail
Collide()constructor
public function Collide(radius:Number, 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
radius:Number — The radius of a particle used when calculating the collisions. this radius is multiplied by the scale property of each particle to get the particle's actual size and relative mass for calculating the collision and response.
 
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 particle to loose enegy in the collision. A value greater than 1 causes the particle to gain energy in the collision.

See also

org.flintparticles.common.emitters.Emitter.addAction()
Method detail
addedToEmitter()method
public override function addedToEmitter(emitter:Emitter):void

The addedToEmitter method is called by the emitter when the Action is added to it It is called within the emitter's addAction method and need not be called by the user.

Parameters
emitter:Emitter — The Emitter that the Action was added to.
getDefaultPriority()method 
public override function getDefaultPriority():Number

The getDefaultPriority method is used to order the execution of actions. It is called within the emitter's addAction method when the user doesn't manually set a priority. It need not be called directly by the user.

Returns
Number
update()method 
public override function update(emitter:Emitter, particle:Particle, time:Number):void

The update method is used by the emitter to apply the action to every particle. It is called within the emitter's update loop 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.