Packagecom.fileitup.fisixengine.core
Classpublic final class FisixEngine
InheritanceFisixEngine Inheritance FisixObject Inheritance CollisionObject

This is the first class that should be instanciated in your simulation. it contains methods for adding physical objects to the simulation and
also attaching flash's DisplayObjects to any object in the engine

You can run the simulation loop with one of two methods:
1. use the FisixEngine.startEngine() method
2. call the method FisixEngine.mainLoop(dt) on every frame of your movie br>
The FisixEngine class inherits most of its functionality from the FisixObject class

See also

FisixObject


Public Properties
 PropertyDefined by
 Inheritedactive : Boolean = true
Tells the engine whether or not to treat this object as a part of the simulation
This value may be changed at any time during the simulation
CollisionObject
 InheritedaxisAligned : Boolean = false
When set to true, the FisixObject will be Rigid and Axis-Aligned.
When the FisixObject is 'axisAligned', all the Particles within will always maintain the same distance to eachother.
Additionally, the entire object will not rotate.
FisixObject
 Inheritedbounce : Number = .5
The object's coefficient of reinstiturion.
CollisionObject
 InheritedboundsCollisions : Boolean = false
When true, all children of the FisixObject will be confined to the boundaries set by setBounds()
FisixObject
 Inheritedcollidable : Boolean = true
Tells the engine whether or not to check collisions against this object You may set this value at any time during the sumulation to turn collision detection on/off for this object
CollisionObject
 Inheritedcolor : int = -1
The object's rendering color.
CollisionObject
 Inheritedconstraints : Array
an array containing all of the Constraints in the FisixObject.
FisixObject
 Inheritedconstraints : Array
FisixObject
 Inheritedcontainers : Array
an array containing all of the Containers in the FisixObject.
FisixObject
 Inheritedcontainers : Array
FisixObject
 InheriteddisplayAttachers : Array
FisixObject
 Inheriteddrag : Number = 0
A value between 0 - 1 representing the amount of drag to apply on all children of the object.
FisixObject
 InheriteddynamicObjectCollisions : Boolean = false
CollisionObject
 InheritedfisixObjects : Array
an array containing all of the FisixObjects in the FisixObject.
FisixObject
 InheritedfisixObjects : Array
FisixObject
 Inheritedfixed : Boolean
A fixed CollisionObject is never influenced by collisions You may change this value at any time
CollisionObject
 Inheritedfriction : Number = 0
The object's coefficient of friction.
CollisionObject
  graphics : Graphics
[static]
FisixEngine
  gravity : Vector
FisixEngine
 Inheritedguides : Array
an array containing all of the GuideParticles in the FisixObject.
FisixObject
 Inheritedguides : Array
FisixObject
 InheritedinheritAttributesOnAdd : Boolean = true
CollisionObject
 InheritedinnerCollisions : Boolean = true
When true, objects within the FisixObject will collide with among themselves.
FisixObject
 InheritedlastCollision : CollisionData
An internal object which stores the information of the object's last collision
CollisionObject
 Inheritedmagnetic : Boolean = true
If true, the object is affected by magnets
CollisionObject
 Inheritedmagnets : Array
an array containing all of the Magnets in the FisixObject.
FisixObject
 Inheritedmagnets : Array
FisixObject
 InheritedminX : Number
Hold the dimensions of the object's bounding box.
CollisionObject
  mouseAttachers : Array
FisixEngine
 Inheritedname : String = ""
CollisionObject
 Inheritedparent : FisixObject
The parent of the object.
CollisionObject
 Inheritedparticles : Array
an array containing all of the Particles in the FisixObject.
FisixObject
 Inheritedparticles : Array
FisixObject
 Inheritedpolygons : Array
an array containing all of the Polygons in the FisixObject.
FisixObject
 Inheritedraycast : Boolean
An internal property, used by the engine
CollisionObject
 InheritedrenderBoundingBoxes : Boolean = false
When true, calling render() will also render the bounding boxes of all children objects
FisixObject
 Inheritedsurfaces : Array
an array containing all of the Surfaces in the FisixObject.
FisixObject
 Inheritedsurfaces : Array
FisixObject
 Inheritedthrusts : Array
an array containing all of the Thrusts in the FisixObject.
FisixObject
 Inheritedthrusts : Array
FisixObject
 Inheritedtraction : Number = 1
The object's traction.
CollisionObject
 Inheritedtype : String
A string representing the type of object you are dealing with
CollisionObject
Protected Properties
 PropertyDefined by
 Inheritedbounds : BoundingBox
FisixObject
 InheriteddetectionMode : int = 0
CollisionObject
 Inheritediterations : int = 3
FisixObject
 InheritedmFixed : Boolean = false
CollisionObject
 InheritedmMaterial : String
CollisionObject
 InheritedmStatic : Boolean = false
CollisionObject
 InheritedmyType : String = ""
CollisionObject
 InheritedreactionMode : int = 0
CollisionObject
 InheriteduseRaycasting : Boolean = false
CollisionObject
Public Methods
 MethodDefined by
  
FisixEngine
 Inherited
Returns whether or not this object's AABB is intersecting with the given object's AABB
CollisionObject
 Inherited
Adds a constraint to the engine from an object previously instanciated.
FisixObject
 Inherited
Adds a container to the FisixObject.
FisixObject
 Inherited
Use to add a DisplayAttacher object to the simulation
FisixObject
 Inherited
Adds a Magnet Object to the simulation.
FisixObject
  
Use to add a MouseAttacher object to the simulation
FisixEngine
 Inherited
Used to add an object instantiated by the user to the object.
FisixObject
 Inherited
Adds a thrust to the engine.
FisixObject
 Inherited
applyForce(f:Vector, checkAA:Boolean = true):void
Applies a force to all of the dynamic objects within the FisixObject
FisixObject
 Inherited
Applies a force at the given point.
CollisionObject
 Inherited
constraintAllParticles(stiffness:Number = 1, breakPoint:Number = 0):void
Constraints all of the particles of the object to eachother.
FisixObject
  
dispose():void
FisixEngine
 Inherited
explode(pos:Vector, force:Number, recursive:Boolean = true):void
Create an explosion in the given position which will affect all the objects within the FisixObject.
FisixObject
 Inherited
FisixObject
 Inherited
CollisionObject
 Inherited
FisixObject
 Inherited
CollisionObject
 Inherited
fix(f:Boolean = true):void
Another way of setting the value 'fixed'.
CollisionObject
 Inherited
flipJoints():void
Flips all the angular constraints in the FisixObject
FisixObject
 Inherited
FisixObject
 Inherited
Returns the center point of all the objects in the FisixObject Editing this vector will have no affects on the object.
FisixObject
 Inherited
CollisionObject
 Inherited
FisixObject
 Inherited
getMaterial():String
The name of the current material applied to the object
CollisionObject
 Inherited
CollisionObject
 Inherited
getNormalAt(p:Vector, dirVector:Vector = null):Vector
CollisionObject
 Inherited
CollisionObject
  
getRealFPS():Number
Returns the current framerate of your simulation.
FisixEngine
 Inherited
integrate(dt:Number = 1):void
Integrates all children forward in time.
FisixObject
 Inherited
isStatic():Boolean
Returns a value indicating whether or not this object was made static.
CollisionObject
  
mainLoop(dt:Number = 1):void
This method should be called in your ENTER_FRAME event if you decide not to use startEngine().
FisixEngine
 Inherited
makeStatic():void
Tells the engine to treat all objects within this FisixObject as static.
FisixObject
 Inherited
move(tX:Number, tY:Number, recursive:Boolean = true):void
simply translates all children of the object by the given x and y offsets
FisixObject
 Inherited
newAngularConstraint(pA:Particle, pB:Particle, pC:Particle, min:Number = -1, max:Number = -1):AngularConstraint
FisixObject
 Inherited
newCircleContainer(x:Number, y:Number, rad:Number, innerDynamics:Boolean = true):CircleContainer
Creates and adds a CircleConstraint in one line.
FisixObject
 Inherited
newCircleParticle(x:Number, y:Number, r:Number):CircleParticle
Creates and adds a CircleParticle in one line.
FisixObject
 Inherited
newConstraintAttacher(mc:DisplayObject, springConstraint:SpringConstraint, angOff:Number = 0, mult:Number = 1):ConstraintAttacher
Creates and adds a ConstraintAttacher to the engine.
FisixObject
 Inherited
newDisplayAttacher(mc:DisplayObject, v1:Vector, xOffset:Number = 0, yOffset:Number = 0):DisplayAttacher2
Creates and adds a DisplayAttacher to the engine.
FisixObject
 Inherited
newDisplayAttacher2(mc:DisplayObject, v1:Vector, v2:Vector, angOff:Number = 0, mult:Number = 1):DisplayAttacher2
Creates and adds a DisplayAttacher2 to the engine.
FisixObject
 Inherited
newDisplayAttacher3(mc:DisplayObject, v1:Vector, v2:Vector, v3:Vector, angOff:Number = 0, mult:Number = 1):DisplayAttacher3
Creates and adds a DisplayAttacher3 to the engine.
FisixObject
 Inherited
Creates and adds a DynamicSurface in one line.
FisixObject
 Inherited
Creates and adds a FisixObject in one line
FisixObject
 Inherited
newGuideParticle(x:Number, y:Number):GuideParticle
Creates and adds a GuideParticle in one line.
FisixObject
 Inherited
newMagnet(force:Number, x:Number, y:Number):Magnet
Creates and adds a Magnet in one line.
FisixObject
  
newMouseAttacher(obj:Particle, mouse:DisplayObject, ease:Number = 1):MouseAttacher
Creates and adds a MouseAttacher to the engine.
FisixEngine
 Inherited
newParticleAttacher(mc:DisplayObject, particle:Particle, xOffset:Number = 0, yOffset:Number = 0):ParticleAttacher
Creates and adds a ParticleAttacher to the engine.
FisixObject
 Inherited
newSpringConstraint(pA:Particle, pB:Particle, stiffness:Number = 0.5, restlength:Number = -1):SpringConstraint
Creates and adds a SpringConstraint in one line.
FisixObject
 Inherited
newStickConstraint(pA:Particle, pB:Particle, restlength:Number = -1):StickConstraint
Creates and adds a StickConstraint in one line.
FisixObject
 Inherited
newSurface(vA:Vector, vB:Vector, r:Number = 0):Surface
Creates and adds a static Surface in one line.
FisixObject
 Inherited
newSurfaceAttacher(mc:DisplayObject, surface:Surface, angOff:Number = 0, mult:Number = 1):SurfaceAttacher
Creates and adds a SurfaceAttacher to the engine.
FisixObject
 Inherited
newThrust(x:Number, y:Number):Vector
Creates and adds a Thrust in one line.
FisixObject
 Inherited
newWheelAttacher(mc:DisplayObject, wheel:WheelParticle, angOff:Number = 0, mult:Number = 1):WheelAttacher
Creates and adds a WheelAttacher to the engine.
FisixObject
 Inherited
newWheelContainer(x:Number, y:Number, rad:Number, innerDynamics:Boolean = true):WheelContainer
FisixObject
 Inherited
newWheelParticle(x:Number, y:Number, r:Number):WheelParticle
Creates and adds a WheelParticle in one line.
FisixObject
 Inherited
onInit():void
Called after the object is initiated by a FisixObject to which it was added
CollisionObject
 Inherited
pickParticle(x:Number, y:Number, radius:Number = 0):CircleParticle
Finds a particle located at the given position
FisixObject
 Inherited
pointForce(point:Vector, force:Number):void
Applies a force value on the object from the given point.
FisixObject
 Inherited
removeConstraint(c:Constraint, disposeObject:Boolean = false):Constraint
Removes a constraint previously added to the FisixObject.
FisixObject
 Inherited
removeContainer(c:FisixContainer, disposeObject:Boolean = false):FisixContainer
Removes a Container previously added.
FisixObject
 Inherited
Use to remove a DisplayAttacher object that was added to the simulation
FisixObject
 Inherited
removeMagnet(m:Magnet, disposeObject:Boolean = false):Magnet
Removes a Magnet that was previously added.
FisixObject
  
Removes a MouseAttacher object that was added to the simulation.
FisixEngine
 Inherited
removeObject(obj:CollisionObject, disposeObject:Boolean = false):CollisionObject
Removes any object added using addObject().
FisixObject
 Inherited
Removes a thrust added with addThrust().
FisixObject
 Inherited
render(g:Graphics):void
renders all children to the given Graphics object.
FisixObject
  
renderAll(g:Graphics = null):void
Renders all of the objects in the current simulation.
FisixEngine
 Inherited
renderBoundingBox(g:Graphics):void
Renders a rectangle representing the bounding box to the graphics object
CollisionObject
 Inherited
renderConstraints(g:Graphics):void
Renders all the constraints within the FisixObject.
FisixObject
 Inherited
renderFisixObjects(g:Graphics):void
Renders all the FisixObjects within the FisixObject.
FisixObject
 Inherited
renderGuides(g:Graphics):void
Renders all the guide particles within the FisixObject.
FisixObject
 Inherited
renderMagnets(g:Graphics):void
Renders all the magnets within the FisixObject.
FisixObject
 Inherited
renderParticles(g:Graphics):void
Renders all the particles within the FisixObject.
FisixObject
 Inherited
renderPolygons(g:Graphics):void
Renders all the polygons within the FisixObject.
FisixObject
 Inherited
renderSurfaces(g:Graphics):void
Renders all the surfaces within the FisixObject.
FisixObject
 Inherited
rotateAll(ang:Number, center:Vector = null):void
Rotates all children of the object by the given angle.
FisixObject
 Inherited
rotationalForce(deg:Number, center:Vector = null):void
FisixObject
 Inherited
rotationalThrust(deg:Number, center:Vector = null):void
FisixObject
 Inherited
scale(scaleX:Number, scaleY:Number, flipAngularConstraints:Boolean = false, pivot:Vector = null):void
Scales all the objects withing the FisixObject.
FisixObject
 Inherited
setAllDetectionModes(m:int, recursive:Boolean = true):void
overrides the collision detection mode of all objects within the FisixObject and sets them to the given value.
FisixObject
 Inherited
setAllReactionModes(m:int, recursive:Boolean = true):void
overrides the collision reaction mode of all objects within the FisixObject and sets them to the given value This does not affect the settings of objects added after this call
FisixObject
 Inherited
setBounce(b:Number, recursive:Boolean = true):void
FisixObject
 Inherited
Sets the bounding rectangle of all the objects within the FisixObject.
FisixObject
 Inherited
setCenter(cX:Number, cY:Number, thrustObject:Boolean = false):void
Moves all children of the object so that their center corresponds with the given values.
FisixObject
 Inherited
setDetectionMode(m:int):void
Sets the collision detection mode to be used by the object
CollisionObject
 Inherited
setDrag(d:Number, recursive:Boolean = true):void
FisixObject
 Inherited
setFixed(f:Boolean, recursive:Boolean = true):void
FisixObject
  
setFPS(fps:int):void
Sets the target framerate from the simulation
FisixEngine
 Inherited
setFriction(f:Number, recursive:Boolean = true):void
FisixObject
  
setGravity(gX:Number, gY:Number):void
Sets the global gravity for the entire simulation.
FisixEngine
 Inherited
setIterations(iter:int):void
Sets the amount of times per frame that the collisions and constraints within this object's children should be solved.
FisixObject
 Inherited
setMagnetic(m:Boolean, recursive:Boolean = true):void
FisixObject
 Inherited
setMaterial(mName:String):void
Sets the material of the object This modifies the object's 'friction', 'bounce', 'color' and 'traction' properties.
CollisionObject
 Inherited
setReactionMode(m:int):void
Sets the collision reaction mode to be used by the object
CollisionObject
  
setRender(r:Boolean):void
Tells the engine to render to the 'renderGraphics' Graphics object at every frame.
FisixEngine
  
setRenderGraphics(g:Graphics):void
Sets the graphics object to which all primitives will be rendered.
FisixEngine
 Inherited
setTraction(t:Number, recursive:Boolean = true):void
FisixObject
 Inherited
setVelocity(vel:Vector, checkAA:Boolean = true):void
FisixObject
  
startEngine(fps:int = 30):void
Starts the engine without the need to use onEnterFrame.
FisixEngine
  
stopEngine():void
Used in conjuntion with startEngine to pause the engie.
FisixEngine
 Inherited
thrust(tX:Number, tY:Number, checkAA:Boolean = true):void
Thrusts all collision objects in the object with the given force
FisixObject
 Inherited
thrustPoint(tX:Number, tY:Number, p:Vector):void
Unlike thrust which moves the whole object, thrustPoint() hits the object from the given point, with the given x,y values and adds the values to its velocity.
CollisionObject
  
timestep(dt:Number):void
Updates the simulation by the given time amount.
FisixEngine
 Inherited
unload():void
Removes the object from the engine and disposes of it.
CollisionObject
 Inherited
Updates the bounding box of the object.
CollisionObject
 Inherited
updates all the DisplayAttachers in the engine.
FisixObject
  
updateMice():void
updates all the MouseAttachers in the engine.
FisixEngine
Protected Methods
 MethodDefined by
 Inherited
FisixObject
 Inherited
Override this function to perform an action after a collision is resolved
CollisionObject
 Inherited
afterUnload():void
Override this method to perform actions after the object has been unloaded.
CollisionObject
 Inherited
FisixObject
 Inherited
FisixObject
 Inherited
Override this function to perform an action at the time a collision is detected
CollisionObject
 Inherited
onUnload():void
Override this method to perform actions once the object is unloaded.
CollisionObject
 Inherited
staticUpdate():void
FisixObject
Property detail
graphicsproperty
public static var graphics:Graphics
gravityproperty 
public var gravity:Vector
mouseAttachersproperty 
public var mouseAttachers:Array
Constructor detail
FisixEngine()constructor
public function FisixEngine()
Method detail
addMouseAttacher()method
public function addMouseAttacher(m:MouseAttacher):MouseAttacher

Use to add a MouseAttacher object to the simulation

Parameters
m:MouseAttacher — An instance of the MouseAttacher class, or any of its descendents. return The added object is successful. null if there was an error

Returns
MouseAttacher
dispose()method 
public override function dispose():void

getRealFPS()method 
public function getRealFPS():Number

Returns the current framerate of your simulation. This may differ from the fps value you set because the cpu cannot perform.

Returns
Number

See also

setFPS()
mainLoop()method 
public function mainLoop(dt:Number = 1):void

This method should be called in your ENTER_FRAME event if you decide not to use startEngine(). This method is self-sufficient, and is the only one that you need to call on every frame.

Parameters
dt:Number (default = 1)
newMouseAttacher()method 
public function newMouseAttacher(obj:Particle, mouse:DisplayObject, ease:Number = 1):MouseAttacher

Creates and adds a MouseAttacher to the engine.

Parameters
obj:Particle — A Particle to attach to the mouse. (ie a Particle, Wheel, Polygon...)
 
mouse:DisplayObject — A Flash DisplayObject which serves as the parent of the mouse (ie. root)
 
ease:Number (default = 1) — A value higher or equal to one which represents the amount of easing to be applied. One represents no easing.

Returns
MouseAttacher — The created MouseAttacher. null if creation was unsuccessful

See also

fileiup.fisixengine.graphics.ParticleAttacher
removeMouseAttacher()method 
public function removeMouseAttacher(m:MouseAttacher):MouseAttacher

Removes a MouseAttacher object that was added to the simulation.

Parameters
m:MouseAttacher

Returns
MouseAttacher
renderAll()method 
public function renderAll(g:Graphics = null):void

Renders all of the objects in the current simulation.

Parameters
g:Graphics (default = null) — A graphics object to render to. if none is supplied, the one set by setRenderGraphics() will be used.

See also

setFPS()method 
public function setFPS(fps:int):void

Sets the target framerate from the simulation

Parameters
fps:int
setGravity()method 
public function setGravity(gX:Number, gY:Number):void

Sets the global gravity for the entire simulation.
This method simply adds a thrust to all the objects within the world

Parameters
gX:Number
 
gY:Number

See also

Thrust
setRender()method 
public function setRender(r:Boolean):void

Tells the engine to render to the 'renderGraphics' Graphics object at every frame. This is only used in the 'mainLoop' method.

Parameters
r:Boolean
setRenderGraphics()method 
public function setRenderGraphics(g:Graphics):void

Sets the graphics object to which all primitives will be rendered. Only used if setRender(true) is called

Parameters
g:Graphics

See also

startEngine()method 
public function startEngine(fps:int = 30):void

Starts the engine without the need to use onEnterFrame.

Parameters
fps:int (default = 30) — the target fps value for the engine.

See also

stopEngine()method 
public function stopEngine():void

Used in conjuntion with startEngine to pause the engie.

See also

timestep()method 
public function timestep(dt:Number):void

Updates the simulation by the given time amount. This method is invoked automatically and shouldn't be used manually.

Parameters
dt:Number
updateMice()method 
public function updateMice():void

updates all the MouseAttachers in the engine. This method is invoked automatically by the engine.