Packageorg.flintparticles.twoD.actions
Classpublic class BoundingBox
InheritanceBoundingBox Inheritance ActionBase Inheritance Object

The BoundingBox action confines each particle to a rectangle region. The particle bounces back off the sides of the rectangle when it reaches the edge. The bounce treats the particle as a circular body. By default, no energy is lost in the collision. This can be modified by setting the bounce property to a value other than 1, its default value. This action has a priority of -20, so that it executes after all movement has occured.



Public Properties
 PropertyDefined By
  bottom : Number
The left coordinate of the bounding box.
BoundingBox
  bounce : Number
The coefficient of restitution when the particles bounce off the sides of the box.
BoundingBox
  left : Number
The left coordinate of the bounding box.
BoundingBox
 Inheritedpriority : int
Returns a default priority of 0 for this action.
ActionBase
  right : Number
The left coordinate of the bounding box.
BoundingBox
  top : Number
The top coordinate of the bounding box.
BoundingBox
Protected Properties
 PropertyDefined By
 Inherited_priority : int = 0
ActionBase
Public Methods
 MethodDefined By
  
BoundingBox(left:Number = 0, top:Number = 0, right:Number = 0, bottom:Number = 0, bounce:Number = 1)
The constructor creates a BoundingBox action for use by an emitter.
BoundingBox
 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] Tests whether the particle is at the edge of the box and, if so, adjusts its velocity to bounce in back towards the center of the box.
BoundingBox
Property Detail
bottomproperty
bottom:Number

The left coordinate of the bounding box.


Implementation
    public function get bottom():Number
    public function set bottom(value:Number):void
bounceproperty 
bounce:Number

The coefficient of restitution when the particles bounce off the sides of the box. A value of 1 gives a pure 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
leftproperty 
left:Number

The left coordinate of the bounding box.


Implementation
    public function get left():Number
    public function set left(value:Number):void
rightproperty 
right:Number

The left coordinate of the bounding box.


Implementation
    public function get right():Number
    public function set right(value:Number):void
topproperty 
top:Number

The top coordinate of the bounding box.


Implementation
    public function get top():Number
    public function set top(value:Number):void
Constructor Detail
BoundingBox()Constructor
public function BoundingBox(left:Number = 0, top:Number = 0, right:Number = 0, bottom:Number = 0, bounce:Number = 1)

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

Parameters
left:Number (default = 0) — The left coordinate of the box.
 
top:Number (default = 0) — The top coordinate of the box.
 
right:Number (default = 0) — The right coordinate of the box.
 
bottom:Number (default = 0) — The bottom coordinate of the box.
 
bounce:Number (default = 1) — The coefficient of restitution when the particles bounce off the sides of the box. 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

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

Tests whether the particle is at the edge of the box and, if so, adjusts its velocity to bounce in back towards the center of the box.

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