Packageorg.flintparticles.twoD.actions
Classpublic class CollisionZone
InheritanceCollisionZone Inheritance ActionBase Inheritance Object

The CollisionZone action detects collisions between particles and a zone, modifying the particles' velocities in response to the collision. All particles are approximated to a circular shape for the collisions.

This action has a priority of -30, so that it executes after most other actions.

Default MXML Propertyzone



Public Properties
 PropertyDefined By
  bounce : Number
The coefficient of restitution when the particles collide.
CollisionZone
 Inheritedpriority : int
Returns a default priority of 0 for this action.
ActionBase
  zone : Zone2D
The zone that the particles should collide with.
CollisionZone
Protected Properties
 PropertyDefined By
 Inherited_priority : int = 0
ActionBase
Public Methods
 MethodDefined By
  
CollisionZone(zone:Zone2D = null, bounce:Number = 1)
The constructor creates a CollisionZone action for use by an emitter.
CollisionZone
 Inherited
addedToEmitter(emitter:Emitter):void
This method does nothing.
ActionBase
 Inherited
This method does nothing.
ActionBase
  
update(emitter:Emitter, particle:Particle, time:Number):void
[override] Checks for collisions between the particle and the zone.
CollisionZone
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
zoneproperty 
zone:Zone2D

The zone that the particles should collide with.


Implementation
    public function get zone():Zone2D
    public function set zone(value:Zone2D):void
Constructor Detail
CollisionZone()Constructor
public function CollisionZone(zone:Zone2D = null, bounce:Number = 1)

The constructor creates a CollisionZone action for use by an emitter. To add a CollisionZone to all particles managed by an emitter, use the emitter's addAction method.

Parameters
zone:Zone2D (default = null) — The zone that the particles should collide with.
 
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
update()method
override public function update(emitter:Emitter, particle:Particle, time:Number):void

Checks for collisions between the particle and the zone.

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