Property | Defined by | ||
---|---|---|---|
constraintCollisionCycles : int [static]
Determines the number of times in a single
APEngine.step() cycle that
the constraints and particles have their positions corrected. | APEngine | ||
constraintCycles : int [static]
Determines the number of times in a single
APEngine.step() cycle that
the constraints have their positions corrected. | APEngine | ||
container : DisplayObjectContainer [static]
The default container used by the default painting methods of the particles and
constraints.
| APEngine | ||
damping : Number [static]
The global damping.
| APEngine |
Method | Defined by | ||
---|---|---|---|
[static]
Adds a force to all particles in the system.
| APEngine | ||
[static]
| APEngine | ||
addMasslessForce(v:Vector):void
[static]
Adds a 'massless' force to all particles in the system.
| APEngine | ||
init(dt:Number = 0.25):void
[static]
Initializes the engine.
| APEngine | ||
paint():void
[static]
Calling this method will in turn call each particle and constraint's paint method.
| APEngine | ||
step():void
[static]
The main step function of the engine.
| APEngine |
constraintCollisionCycles | property |
constraintCollisionCycles:int
[read-write]
Determines the number of times in a single APEngine.step()
cycle that
the constraints and particles have their positions corrected. This can greatly increase
stability and prevent breakthroughs, especially with large complex arrangements of
constraints and particles. The larger this number, the more stable the simulation,
at an expense of performance.
This setting differs from the constraintCycles
property in that it
resolves both constraints and collisions during a APEngine.step()
.
The default value is 1.
public static function get constraintCollisionCycles():int
public function set constraintCollisionCycles(value:int):void
constraintCycles | property |
constraintCycles:int
[read-write]
Determines the number of times in a single APEngine.step()
cycle that
the constraints have their positions corrected. Increasing this number can result in
stiffer, more stable configurations of constraints, especially when they are in large
complex arrangements. The trade off is that the higher you set this number the more
performance will suffer.
This setting differs from the constraintCollisionCycles
property in that it
only resolves constraints during a APEngine.step()
. The default value
is 0. Because this property doesn't correct for collisions, you should only use it when
the collisions of an arrangement of particles and constraints are not an issue. If you
do set this value higher than the default of 0, then constraintCollisionCycles
should at least be 1, in order to check collisions one time during the
APEngine.step()
cycle.
public static function get constraintCycles():int
public function set constraintCycles(value:int):void
container | property |
container:DisplayObjectContainer
[read-write]The default container used by the default painting methods of the particles and constraints. If you wish to use to the built in painting methods you must set this first.
Implementation public static function get container():DisplayObjectContainer
public function set container(value:DisplayObjectContainer):void
damping | property |
damping:Number
[read-write]The global damping. Values should be between 0 and 1. Higher numbers result in less damping. A value of 1 is no damping. A value of 0 will not allow any particles to move. The default is 1.
Damping will slow down your simulation and make it more stable. If you find that your sim is "blowing up', try applying more damping.
Implementation public static function get damping():Number
public function set damping(value:Number):void
addForce | () | method |
public static function addForce(v:Vector):void
Adds a force to all particles in the system. The mass of the particle is taken into account when using this method, so it is useful for adding forces that simulate effects like wind. Particles with larger masses will not be affected as greatly as those with smaller masses. Note that the size (not to be confused with mass) of the particle has no effect on its physical behavior.
Parametersv:Vector — A Vector represeting the force added.
|
addGroup | () | method |
addMasslessForce | () | method |
public static function addMasslessForce(v:Vector):void
Adds a 'massless' force to all particles in the system. The mass of the particle is not taken into account when using this method, so it is useful for adding forces that simulate effects like gravity. Particles with larger masses will be affected the same as those with smaller masses. Note that the size (not to be confused with mass) of the particle has no effect on its physical behavior.
Parametersv:Vector — A Vector represeting the force added.
|
init | () | method |
public static function init(dt:Number = 0.25):void
Initializes the engine. You must call this method prior to adding any particles or constraints.
Parametersdt:Number (default = 0.25 ) — The delta time value for the engine. This parameter can be used -- in
conjunction with speed at which APEngine.step() is called -- to change the speed
of the simulation. Typical values are 1/3 or 1/4. Lower values result in slower,
but more accurate simulations, and higher ones result in faster, less accurate ones.
Note that this only applies to the forces added to particles. If you do not add any
forces, the dt value won't matter.
|
paint | () | method |
public static function paint():void
Calling this method will in turn call each particle and constraint's paint method. Generally you would call this method after stepping the engine in the main program cycle.
step | () | method |
public static function step():void
The main step function of the engine. This method should be called continously to advance the simulation. The faster this method is called, the faster the simulation will run. Usually you would call this in your main program loop.