Packagecom.fileitup.fisixengine.core
Classpublic class FisixObject
InheritanceFisixObject Inheritance CollisionObject
SubclassesFisixEngine, FractalTerrain, Rope

The main class of the engine. This is used as a way of grouping objects

In order to achieve better performance, divide the objects in your code into logical FisixObjects. for example, a 4x4 car FisixObject might contain two ParticleWheels, a child FisixObjects which holds the body, and a towing rope (there's an idea for a game right there ;))

It's important to note that a FisixObject has no real physical presence in the engine. It can be seen as a way of grouping objects together for a more logical workflow. A FisixObject has no explicit x and y positions, although the center point of all it's children may be retrieved at any time through the getCenter() method

See also

getCenter()


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
  axisAligned : 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
  boundsCollisions : 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
  constraints : Array
an array containing all of the Constraints in the FisixObject.
FisixObject
  constraints : Array
FisixObject
  containers : Array
an array containing all of the Containers in the FisixObject.
FisixObject
  containers : Array
FisixObject
  displayAttachers : Array
FisixObject
  drag : 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
  fisixObjects : Array
an array containing all of the FisixObjects in the FisixObject.
FisixObject
  fisixObjects : 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
  guides : Array
an array containing all of the GuideParticles in the FisixObject.
FisixObject
  guides : Array
FisixObject
 InheritedinheritAttributesOnAdd : Boolean = true
CollisionObject
  innerCollisions : 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
  magnets : Array
an array containing all of the Magnets in the FisixObject.
FisixObject
  magnets : Array
FisixObject
 InheritedminX : Number
Hold the dimensions of the object's bounding box.
CollisionObject
 Inheritedname : String = ""
CollisionObject
 Inheritedparent : FisixObject
The parent of the object.
CollisionObject
  particles : Array
an array containing all of the Particles in the FisixObject.
FisixObject
  particles : Array
FisixObject
  polygons : Array
an array containing all of the Polygons in the FisixObject.
FisixObject
 Inheritedraycast : Boolean
An internal property, used by the engine
CollisionObject
  renderBoundingBoxes : Boolean = false
When true, calling render() will also render the bounding boxes of all children objects
FisixObject
  surfaces : Array
an array containing all of the Surfaces in the FisixObject.
FisixObject
  surfaces : Array
FisixObject
  thrusts : Array
an array containing all of the Thrusts in the FisixObject.
FisixObject
  thrusts : 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
  bounds : BoundingBox
FisixObject
 InheriteddetectionMode : int = 0
CollisionObject
  iterations : 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
  
Creates a FisixObject
FisixObject
 Inherited
Returns whether or not this object's AABB is intersecting with the given object's AABB
CollisionObject
  
Adds a constraint to the engine from an object previously instanciated.
FisixObject
  
Adds a container to the FisixObject.
FisixObject
  
Use to add a DisplayAttacher object to the simulation
FisixObject
  
Adds a Magnet Object to the simulation.
FisixObject
  
Used to add an object instantiated by the user to the object.
FisixObject
  
Adds a thrust to the engine.
FisixObject
  
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
  
constraintAllParticles(stiffness:Number = 1, breakPoint:Number = 0):void
Constraints all of the particles of the object to eachother.
FisixObject
  
dispose():void
FisixObject
  
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
  
FisixObject
 Inherited
CollisionObject
  
FisixObject
 Inherited
CollisionObject
 Inherited
fix(f:Boolean = true):void
Another way of setting the value 'fixed'.
CollisionObject
  
flipJoints():void
Flips all the angular constraints in the FisixObject
FisixObject
  
FisixObject
  
Returns the center point of all the objects in the FisixObject Editing this vector will have no affects on the object.
FisixObject
 Inherited
CollisionObject
  
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
  
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
  
makeStatic():void
Tells the engine to treat all objects within this FisixObject as static.
FisixObject
  
move(tX:Number, tY:Number, recursive:Boolean = true):void
simply translates all children of the object by the given x and y offsets
FisixObject
  
newAngularConstraint(pA:Particle, pB:Particle, pC:Particle, min:Number = -1, max:Number = -1):AngularConstraint
FisixObject
  
newCircleContainer(x:Number, y:Number, rad:Number, innerDynamics:Boolean = true):CircleContainer
Creates and adds a CircleConstraint in one line.
FisixObject
  
newCircleParticle(x:Number, y:Number, r:Number):CircleParticle
Creates and adds a CircleParticle in one line.
FisixObject
  
newConstraintAttacher(mc:DisplayObject, springConstraint:SpringConstraint, angOff:Number = 0, mult:Number = 1):ConstraintAttacher
Creates and adds a ConstraintAttacher to the engine.
FisixObject
  
newDisplayAttacher(mc:DisplayObject, v1:Vector, xOffset:Number = 0, yOffset:Number = 0):DisplayAttacher2
Creates and adds a DisplayAttacher to the engine.
FisixObject
  
newDisplayAttacher2(mc:DisplayObject, v1:Vector, v2:Vector, angOff:Number = 0, mult:Number = 1):DisplayAttacher2
Creates and adds a DisplayAttacher2 to the engine.
FisixObject
  
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
  
Creates and adds a DynamicSurface in one line.
FisixObject
  
Creates and adds a FisixObject in one line
FisixObject
  
newGuideParticle(x:Number, y:Number):GuideParticle
Creates and adds a GuideParticle in one line.
FisixObject
  
newMagnet(force:Number, x:Number, y:Number):Magnet
Creates and adds a Magnet in one line.
FisixObject
  
newParticleAttacher(mc:DisplayObject, particle:Particle, xOffset:Number = 0, yOffset:Number = 0):ParticleAttacher
Creates and adds a ParticleAttacher to the engine.
FisixObject
  
newSpringConstraint(pA:Particle, pB:Particle, stiffness:Number = 0.5, restlength:Number = -1):SpringConstraint
Creates and adds a SpringConstraint in one line.
FisixObject
  
newStickConstraint(pA:Particle, pB:Particle, restlength:Number = -1):StickConstraint
Creates and adds a StickConstraint in one line.
FisixObject
  
newSurface(vA:Vector, vB:Vector, r:Number = 0):Surface
Creates and adds a static Surface in one line.
FisixObject
  
newSurfaceAttacher(mc:DisplayObject, surface:Surface, angOff:Number = 0, mult:Number = 1):SurfaceAttacher
Creates and adds a SurfaceAttacher to the engine.
FisixObject
  
newThrust(x:Number, y:Number):Vector
Creates and adds a Thrust in one line.
FisixObject
  
newWheelAttacher(mc:DisplayObject, wheel:WheelParticle, angOff:Number = 0, mult:Number = 1):WheelAttacher
Creates and adds a WheelAttacher to the engine.
FisixObject
  
newWheelContainer(x:Number, y:Number, rad:Number, innerDynamics:Boolean = true):WheelContainer
FisixObject
  
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
  
pickParticle(x:Number, y:Number, radius:Number = 0):CircleParticle
Finds a particle located at the given position
FisixObject
  
pointForce(point:Vector, force:Number):void
Applies a force value on the object from the given point.
FisixObject
  
removeConstraint(c:Constraint, disposeObject:Boolean = false):Constraint
Removes a constraint previously added to the FisixObject.
FisixObject
  
removeContainer(c:FisixContainer, disposeObject:Boolean = false):FisixContainer
Removes a Container previously added.
FisixObject
  
Use to remove a DisplayAttacher object that was added to the simulation
FisixObject
  
removeMagnet(m:Magnet, disposeObject:Boolean = false):Magnet
Removes a Magnet that was previously added.
FisixObject
  
removeObject(obj:CollisionObject, disposeObject:Boolean = false):CollisionObject
Removes any object added using addObject().
FisixObject
  
Removes a thrust added with addThrust().
FisixObject
  
render(g:Graphics):void
renders all children to the given Graphics object.
FisixObject
 Inherited
renderBoundingBox(g:Graphics):void
Renders a rectangle representing the bounding box to the graphics object
CollisionObject
  
renderConstraints(g:Graphics):void
Renders all the constraints within the FisixObject.
FisixObject
  
renderFisixObjects(g:Graphics):void
Renders all the FisixObjects within the FisixObject.
FisixObject
  
renderGuides(g:Graphics):void
Renders all the guide particles within the FisixObject.
FisixObject
  
renderMagnets(g:Graphics):void
Renders all the magnets within the FisixObject.
FisixObject
  
renderParticles(g:Graphics):void
Renders all the particles within the FisixObject.
FisixObject
  
renderPolygons(g:Graphics):void
Renders all the polygons within the FisixObject.
FisixObject
  
renderSurfaces(g:Graphics):void
Renders all the surfaces within the FisixObject.
FisixObject
  
rotateAll(ang:Number, center:Vector = null):void
Rotates all children of the object by the given angle.
FisixObject
  
rotationalForce(deg:Number, center:Vector = null):void
FisixObject
  
rotationalThrust(deg:Number, center:Vector = null):void
FisixObject
  
scale(scaleX:Number, scaleY:Number, flipAngularConstraints:Boolean = false, pivot:Vector = null):void
Scales all the objects withing the FisixObject.
FisixObject
  
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
  
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
  
setBounce(b:Number, recursive:Boolean = true):void
FisixObject
  
Sets the bounding rectangle of all the objects within the FisixObject.
FisixObject
  
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
  
setDrag(d:Number, recursive:Boolean = true):void
FisixObject
  
setFixed(f:Boolean, recursive:Boolean = true):void
FisixObject
  
setFriction(f:Number, recursive:Boolean = true):void
FisixObject
  
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
  
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
  
setTraction(t:Number, recursive:Boolean = true):void
FisixObject
  
setVelocity(vel:Vector, checkAA:Boolean = true):void
FisixObject
  
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
 Inherited
unload():void
Removes the object from the engine and disposes of it.
CollisionObject
 Inherited
Updates the bounding box of the object.
CollisionObject
  
updates all the DisplayAttachers in the engine.
FisixObject
Protected Methods
 MethodDefined by
  
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
  
FisixObject
  
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
  
staticUpdate():void
FisixObject
Property detail
axisAlignedproperty
public var axisAligned: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. To rotate manually, use rotateAll(). Using rotationalThrust() or rotationalForce will not work correctly when axisAligned is true.

See also

boundsproperty 
protected var bounds:BoundingBox
boundsCollisionsproperty 
public var boundsCollisions:Boolean = false

When true, all children of the FisixObject will be confined to the boundaries set by setBounds()

See also

constraintsproperty 
public var constraints:Array

an array containing all of the Constraints in the FisixObject. To avoid errors, refrain from accessing the elements in this array directly.

constraintsproperty 
public var constraints:Array
containersproperty 
public var containers:Array

an array containing all of the Containers in the FisixObject. To avoid errors, refrain from accessing the elements in this array directly.

containersproperty 
public var containers:Array
displayAttachersproperty 
public var displayAttachers:Array
dragproperty 
public var drag:Number = 0

A value between 0 - 1 representing the amount of drag to apply on all children of the object.

0 - no drag
1 - full drag (no movement at all)

fisixObjectsproperty 
public var fisixObjects:Array

an array containing all of the FisixObjects in the FisixObject. To avoid errors, refrain from accessing the elements in this array directly.

fisixObjectsproperty 
public var fisixObjects:Array
guidesproperty 
public var guides:Array

an array containing all of the GuideParticles in the FisixObject. To avoid errors, refrain from accessing the elements in this array directly.

guidesproperty 
public var guides:Array
innerCollisionsproperty 
public var innerCollisions:Boolean = true

When true, objects within the FisixObject will collide with among themselves. It is usefull to turn this off for performance reasons when no collision checks are necessary (like in a cloth like object) or when a FisixObject contains objects that shouldn't collide with eachother

iterationsproperty 
protected var iterations:int = 3
magnetsproperty 
public var magnets:Array

an array containing all of the Magnets in the FisixObject. To avoid errors, refrain from accessing the elements in this array directly.

magnetsproperty 
public var magnets:Array
particlesproperty 
public var particles:Array

an array containing all of the Particles in the FisixObject. refrain from accessing the elements in this array, instead use a reference obtained from newCircleParticle(), or newWheel()

See also

particlesproperty 
public var particles:Array
polygonsproperty 
public var polygons:Array

an array containing all of the Polygons in the FisixObject. To avoid errors, refrain from accessing the elements in this array directly.

renderBoundingBoxesproperty 
public var renderBoundingBoxes:Boolean = false

When true, calling render() will also render the bounding boxes of all children objects

See also

surfacesproperty 
public var surfaces:Array

an array containing all of the Surfaces in the FisixObject. To avoid errors, refrain from accessing the elements in this array directly.

surfacesproperty 
public var surfaces:Array
thrustsproperty 
public var thrusts:Array

an array containing all of the Thrusts in the FisixObject. To avoid errors, refrain from accessing the elements in this array directly.

thrustsproperty 
public var thrusts:Array
Constructor detail
FisixObject()constructor
public function FisixObject(p:FisixObject = null)

Creates a FisixObject

Parameters
p:FisixObject (default = null) — Parent of the FisixObject. No need to supply a value, addObject() automatically takes care of that whenever an object is added

See also

Method detail
addConstraint()method
public function addConstraint(c:Constraint):Constraint

Adds a constraint to the engine from an object previously instanciated.

Parameters
c:Constraint — Any objects which extends the Constraint class.
This includes SpringConstraints, StickConstraints, and AngularConstraints

Returns
Constraint — If adding was successfull, the object added is returned. Otherwise, null is returned
addContainer()method 
public function addContainer(c:FisixContainer):FisixContainer

Adds a container to the FisixObject.

Parameters
c:FisixContainer — Any object extending the FisixContainer Object
This includes CircleContainers and WheelContainers

Returns
FisixContainer — If adding was successfull, the object added is returned. Otherwise, null is returned

See also

addDisplayAttacher()method 
public function addDisplayAttacher(d:DisplayAttacher):DisplayAttacher

Use to add a DisplayAttacher object to the simulation

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

Returns
DisplayAttacher
addMagnet()method 
public function addMagnet(m:Magnet):Magnet

Adds a Magnet Object to the simulation.

Parameters
m:Magnet — An instance of the Magnet Class.

Returns
Magnet — If adding was successfull, the object added is returned. Otherwise, null is returned.

See also

addObject()method 
public function addObject(obj:CollisionObject):CollisionObject

Used to add an object instantiated by the user to the object. The object must be either a Particle (any type), Surface (any Type) or Polygon(not implemented in alpha) Instead of adding objects you created manually, you can create and add objects in one line with the new[ObjectType] methods

Parameters
obj:CollisionObject

Returns
CollisionObject — Returns the same object passed in if the object was added successfully. Otherwise, returns null

See also

addThrust()method 
public function addThrust(t:Vector):Vector

Adds a thrust to the engine. Thrusts are vector quantities of force that are added to all the children of the FisixObject at every timestep. Thrusts can be used for wind, gravity, etc.
For example, The FisixEngine class uses this with setGravity() to simplify adding a global gravity force.

Parameters
t:Vector — A vector which holds the x and y components of the force to be added

Returns
Vector — If adding was successfull, the thrust added is returned. Otherwise, null is returned

See also

afterChildCollision()method 
protected function afterChildCollision(child:CollisionObject, data:CollisionData):voidParameters
child:CollisionObject
 
data:CollisionData
applyForce()method 
public override function applyForce(f:Vector, checkAA:Boolean = true):void

Applies a force to all of the dynamic objects within the FisixObject

Parameters
f:Vector
 
checkAA:Boolean (default = true)

See also

Particle.applyForce()
constraintAllParticles()method 
public function constraintAllParticles(stiffness:Number = 1, breakPoint:Number = 0):void

Constraints all of the particles of the object to eachother.

This does not include guide particles. For more automatic constraining options, see the static methods for StickConstraint and SpringConstraint.

Parameters
stiffness:Number (default = 1) — If left at one, StickConstraints will be created, otherwise SpringConstraints will.
 
breakPoint:Number (default = 0) — the breakPoint of the created constraints. Leave at 0 to make unbreakable

See also

com.fileitup.fisixengine.constraints.StickConstraint.constraintAll()
com.fileitup.fisixengine.primitives.constraint.breakPoint
addConstraint()
dispose()method 
public override function dispose():void

explode()method 
public function 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.

Parameters
pos:Vector — The global position at which to create the explosion
 
force:Number — The force of the explosion (ie. 200)
 
recursive:Boolean (default = true) — If set to false, the FisixObject withing the calling FisixObject will not be affected.
fireAfterChildCollision()method 
public function fireAfterChildCollision(child:CollisionObject):voidParameters
child:CollisionObject
fireOnChildCollision()method 
public function fireOnChildCollision(child:CollisionObject):voidParameters
child:CollisionObject
flipJoints()method 
public function flipJoints():void

Flips all the angular constraints in the FisixObject

See also

getBounds()method 
public function getBounds():BoundingBox

Returns
BoundingBox — the BoundingBox object of this FisixObject
getCenter()method 
public function getCenter():Vector

Returns the center point of all the objects in the FisixObject Editing this vector will have no affects on the object. Instead use setCenter

Returns
Vector

See also

getIterations()method 
public function getIterations():int

Returns
int — the iterations value for this object.

See also

initChild()method 
protected function initChild(c:CollisionObject):voidParameters
c:CollisionObject
integrate()method 
public function integrate(dt:Number = 1):void

Integrates all children forward in time. This is an internal method, and should not be called directly. The FisixEngine's startEngine() takes care of everything. You can also use FisixEngine.mainLoop() for more control.

Parameters
dt:Number (default = 1) — the amount of seconds to integrate by

See also

makeStatic()method 
public override function makeStatic():void

Tells the engine to treat all objects within this FisixObject as static.

This allows for faster processing of collision detection by setting the engine to static, the engine knows to avoid redundant calculations needed for moving objects. It also fixes all children of the FisixObject in place

See also

Particle..fixed
move()method 
public function move(tX:Number, tY:Number, recursive:Boolean = true):void

simply translates all children of the object by the given x and y offsets

Parameters
tX:Number
 
tY:Number
 
recursive:Boolean (default = true)
newAngularConstraint()method 
public function newAngularConstraint(pA:Particle, pB:Particle, pC:Particle, min:Number = -1, max:Number = -1):AngularConstraintParameters
pA:Particle
 
pB:Particle
 
pC:Particle
 
min:Number (default = -1)
 
max:Number (default = -1)

Returns
AngularConstraint
newCircleContainer()method 
public function newCircleContainer(x:Number, y:Number, rad:Number, innerDynamics:Boolean = true):CircleContainer

Creates and adds a CircleConstraint in one line.

Parameters
x:Number — global x position of the center of the container
 
y:Number — global y position of the center of the container
 
rad:Number — the radius of the container's CircleParticle
 
innerDynamics:Boolean (default = true)

Returns
CircleContainer — If adding was successfull, the object added is returned. Otherwise, null is returned.

See also

newCircleParticle()method 
public function newCircleParticle(x:Number, y:Number, r:Number):CircleParticle

Creates and adds a CircleParticle in one line.

Parameters
x:Number
 
y:Number
 
r:Number

Returns
CircleParticle — If adding was successfull, the object added is returned. Otherwise, null is returned

See also

newConstraintAttacher()method 
public function newConstraintAttacher(mc:DisplayObject, springConstraint:SpringConstraint, angOff:Number = 0, mult:Number = 1):ConstraintAttacher

Creates and adds a ConstraintAttacher to the engine.

Parameters
mc:DisplayObject — A flash DisplayObject (ie. a MovieClip, Sprite, Shape).
 
springConstraint:SpringConstraint — A Constraint object to attach to. This may also be a StickConstraint.
 
angOff:Number (default = 0) — The amount of degrees to offset the angle of the DisplayObject.
 
mult:Number (default = 1) — A value to multiply the angle by beffor adding the offset.

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

See also

fileiup.fisixengine.graphics.ConstraintAttacher
newDisplayAttacher()method 
public function newDisplayAttacher(mc:DisplayObject, v1:Vector, xOffset:Number = 0, yOffset:Number = 0):DisplayAttacher2

Creates and adds a DisplayAttacher to the engine.

Parameters
mc:DisplayObject — A flash DisplayObject (ie. a MovieClip, Sprite, Shape).
 
v1:Vector — The Vector object to attach the DisplayObject to.
 
xOffset:Number (default = 0) — The amount of pixels to offset the DisplayObject on the x axis
 
yOffset:Number (default = 0) — The amount of pixels to offset the DisplayObject on the y axis

Returns
DisplayAttacher2 — The created DisplayAttacher. null if creation was unsuccessful

See also

fileiup.fisixengine.graphics.DisplayAttacher
newDisplayAttacher2()method 
public function newDisplayAttacher2(mc:DisplayObject, v1:Vector, v2:Vector, angOff:Number = 0, mult:Number = 1):DisplayAttacher2

Creates and adds a DisplayAttacher2 to the engine.

Parameters
mc:DisplayObject — A flash DisplayObject (ie. a MovieClip, Sprite, Shape).
 
v1:Vector — The Vector object to attach the DisplayObject to (anchor).
 
v2:Vector — The Vector object to use for angle calculations (target).
 
angOff:Number (default = 0) — The amount of degrees to offset the angle of the DisplayObject.
 
mult:Number (default = 1) — A value to multiply the angle by beffor adding the offset.

Returns
DisplayAttacher2 — The created DisplayAttacher. null if creation was unsuccessful

See also

fileiup.fisixengine.graphics.DisplayAttacher2
newDisplayAttacher3()method 
public function newDisplayAttacher3(mc:DisplayObject, v1:Vector, v2:Vector, v3:Vector, angOff:Number = 0, mult:Number = 1):DisplayAttacher3

Creates and adds a DisplayAttacher3 to the engine.

Parameters
mc:DisplayObject — A flash DisplayObject (ie. a MovieClip, Sprite, Shape).
 
v1:Vector — The Vector object to attach the DisplayObject to (anchor).
 
v2:Vector — The first Vector object to use for angle calculations.
 
v3:Vector — The second Vector object to use for angle calculations.
 
angOff:Number (default = 0) — The amount of degrees to offset the angle of the DisplayObject.
 
mult:Number (default = 1) — A value to multiply the angle by beffor adding the offset.

Returns
DisplayAttacher3 — The created DisplayAttacher. null if creation was unsuccessful

See also

fileiup.fisixengine.graphics.DisplayAttacher3
newDynamicSurface()method 
public function newDynamicSurface(pA:Particle, pB:Particle, r:Number = 0):DynamicSurface

Creates and adds a DynamicSurface in one line.

Parameters
pA:Particle — A vector Object to confine the first point of the surface to.
 
pB:Particle — A vector Object to confine the second point of the surface to.
 
r:Number (default = 0) — The radius of the surface

Returns
DynamicSurface — If adding was successfull, the object added is returned. Otherwise, null is returned

See also

com.fileitup.fisixengine.surface.DynamicSurface
newFisixObject()method 
public function newFisixObject():FisixObject

Creates and adds a FisixObject in one line

Returns
FisixObject — a new FisixObject which has been added to calling FisixObject
newGuideParticle()method 
public function newGuideParticle(x:Number, y:Number):GuideParticle

Creates and adds a GuideParticle in one line.

Parameters
x:Number — The x position of the particle
 
y:Number — The y position of the particle

Returns
GuideParticle — If adding was successfull, the object added is returned. Otherwise, null is returned

See also

newMagnet()method 
public function newMagnet(force:Number, x:Number, y:Number):Magnet

Creates and adds a Magnet in one line.

Parameters
force:Number — A vector representing the magnet's global position. If you'd like to attach an object to the magnet, specify the object's 'pos' property here. To attach the magnet to an object later, use the attachToObject() or attachToVector() methods.
 
x:Number — A number representing the force of the magnet. A positive value makes the magnet attract objects and a negative value repells other objects.
 
y:Number

Returns
Magnet — The vector associated with the thrust.

See also

com.fileitup.fisixengine.core.Magnet
newParticleAttacher()method 
public function newParticleAttacher(mc:DisplayObject, particle:Particle, xOffset:Number = 0, yOffset:Number = 0):ParticleAttacher

Creates and adds a ParticleAttacher to the engine.

Parameters
mc:DisplayObject — A flash DisplayObject (ie. a MovieClip, Sprite, Shape).
 
particle:Particle — The Particle object to attach the DisplayObject to.
 
xOffset:Number (default = 0) — The amount of pixels to offset the DisplayObject on the x axis
 
yOffset:Number (default = 0) — The amount of pixels to offset the DisplayObject on the y axis

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

See also

fileiup.fisixengine.graphics.ParticleAttacher
newSpringConstraint()method 
public function newSpringConstraint(pA:Particle, pB:Particle, stiffness:Number = 0.5, restlength:Number = -1):SpringConstraint

Creates and adds a SpringConstraint in one line.

Parameters
pA:Particle — A Particle to serve as the first endpoint of the constraint. this includes particles and polygons.
 
pB:Particle — A Particle to serve as the second endpoint of the constraint. this includes particles and polygons.
 
stiffness:Number (default = 0.5) — A number between 0 and 1 where 0 represents a spring that can stretch out forever and 1 is completely stiff.
 
restlength:Number (default = -1) — The desired length of the stick constraint. leave at default value (-1) to use the current distance

Returns
SpringConstraint — If adding was successfull, the object added is returned. Otherwise, null is returned.

See also

newStickConstraint()method 
public function newStickConstraint(pA:Particle, pB:Particle, restlength:Number = -1):StickConstraint

Creates and adds a StickConstraint in one line.

Parameters
pA:Particle — A Particle to serve as the first endpoint of the constraint. this includes particles and polygons.
 
pB:Particle — A Particle to serve as the second endpoint of the constraint. this includes particles and polygons.
 
restlength:Number (default = -1) — The desired length of the stick constraint. leave at default value (-1) to use the current distance

Returns
StickConstraint — If adding was successfull, the object added is returned. Otherwise, null is returned.

See also

newSurface()method 
public function newSurface(vA:Vector, vB:Vector, r:Number = 0):Surface

Creates and adds a static Surface in one line.

Parameters
vA:Vector — A vector Object to confine the first point of the surface to.
 
vB:Vector — A vector Object to confine the second point of the surface to.
 
r:Number (default = 0) — The radius of the surface

Returns
Surface — If adding was successfull, the object added is returned. Otherwise, null is returned

See also

newSurfaceAttacher()method 
public function newSurfaceAttacher(mc:DisplayObject, surface:Surface, angOff:Number = 0, mult:Number = 1):SurfaceAttacher

Creates and adds a SurfaceAttacher to the engine.

Parameters
mc:DisplayObject — A flash DisplayObject (ie. a MovieClip, Sprite, Shape).
 
surface:Surface — A Surface object to attach to. This may also be a StickConstraint.
 
angOff:Number (default = 0) — The amount of degrees to offset the angle of the DisplayObject.
 
mult:Number (default = 1) — A value to multiply the angle by beffor adding the offset.

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

See also

fileiup.fisixengine.graphics.SurfaceAttacher
newThrust()method 
public function newThrust(x:Number, y:Number):Vector

Creates and adds a Thrust in one line.

Parameters
x:Number — x force of the thrust
 
y:Number — y force of the thrust

Returns
Vector — The vector associated with the thrust

See also

newWheelAttacher()method 
public function newWheelAttacher(mc:DisplayObject, wheel:WheelParticle, angOff:Number = 0, mult:Number = 1):WheelAttacher

Creates and adds a WheelAttacher to the engine.

Parameters
mc:DisplayObject — A flash DisplayObject (ie. a MovieClip, Sprite, Shape).
 
wheel:WheelParticle — A WheelParticle object to attach to. This may also be a StickConstraint.
 
angOff:Number (default = 0) — The amount of degrees to offset the angle of the DisplayObject.
 
mult:Number (default = 1) — A value to multiply the angle by beffor adding the offset.

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

See also

fileiup.fisixengine.graphics.WheelAttacher
newWheelContainer()method 
public function newWheelContainer(x:Number, y:Number, rad:Number, innerDynamics:Boolean = true):WheelContainerParameters
x:Number
 
y:Number
 
rad:Number
 
innerDynamics:Boolean (default = true)

Returns
WheelContainer
newWheelParticle()method 
public function newWheelParticle(x:Number, y:Number, r:Number):WheelParticle

Creates and adds a WheelParticle in one line.

Parameters
x:Number — The x position of the particle
 
y:Number — The y position of the particle
 
r:Number — The radius of the particle

Returns
WheelParticle — If adding was successfull, the object added is returned. Otherwise, null is returned

See also

onChildCollision()method 
protected function onChildCollision(child:CollisionObject, data:CollisionData):voidParameters
child:CollisionObject
 
data:CollisionData
pickParticle()method 
public function pickParticle(x:Number, y:Number, radius:Number = 0):CircleParticle

Finds a particle located at the given position

Parameters
x:Number — The radius to search for a hit at. This is usefull for picking small objects.
 
y:Number
 
radius:Number (default = 0)

Returns
CircleParticle — If a particle is touched, a reference to it is returned. Otherwise, null is returned.
pointForce()method 
public override function pointForce(point:Vector, force:Number):void

Applies a force value on the object from the given point. The farther the object is from the point, the less it is affected.

Parameters
point:Vector
 
force:Number
removeConstraint()method 
public function removeConstraint(c:Constraint, disposeObject:Boolean = false):Constraint

Removes a constraint previously added to the FisixObject.

Parameters
c:Constraint — Any object that extends the Constraint class.
 
disposeObject:Boolean (default = false)

Returns
Constraint — If removing was successfull, the object removed is returned. Otherwise, null is returned

See also

removeContainer()method 
public function removeContainer(c:FisixContainer, disposeObject:Boolean = false):FisixContainer

Removes a Container previously added.

Parameters
c:FisixContainer
 
disposeObject:Boolean (default = false)

Returns
FisixContainer — If removing was successfull, the object removed is returned. Otherwise, null is returned.
removeDisplayAttacher()method 
public function removeDisplayAttacher(d:DisplayAttacher):DisplayAttacher

Use to remove a DisplayAttacher object that was added to the simulation

Parameters
d:DisplayAttacher

Returns
DisplayAttacher
removeMagnet()method 
public function removeMagnet(m:Magnet, disposeObject:Boolean = false):Magnet

Removes a Magnet that was previously added.

Parameters
m:Magnet
 
disposeObject:Boolean (default = false)

Returns
Magnet — If removing was successfull, the object removed is returned. Otherwise, null is returned.
removeObject()method 
public function removeObject(obj:CollisionObject, disposeObject:Boolean = false):CollisionObject

Removes any object added using addObject(). Note that removing an object also removes all surfaces and constraints that were attached to it

Parameters
obj:CollisionObject
 
disposeObject:Boolean (default = false)

Returns
CollisionObject — If remove was successfull, returns the object that was removed. Otherwise returns null
removeThrust()method 
public function removeThrust(t:Vector):Vector

Removes a thrust added with addThrust(). param t A vector that was added to the Object through addThrust() or a vector returned from newThrust()

Parameters
t:Vector

Returns
Vector — If removing was successfull, the thrust removed is returned. Otherwise, null is returned

See also

render()method 
public override function render(g:Graphics):void

renders all children to the given Graphics object. This method only needs to be used if you are creating a manual simulation loop

Parameters
g:Graphics

See also


Example
The following code renders all objects in the fisix engine to the screen
   var myEngine:FisixEngine = new FisixEngine()
   myEngine.render(root.graphics)
   

renderConstraints()method 
public function renderConstraints(g:Graphics):void

Renders all the constraints within the FisixObject. This method is automatically invoked by render()

Parameters
g:Graphics

See also

renderFisixObjects()method 
public function renderFisixObjects(g:Graphics):void

Renders all the FisixObjects within the FisixObject. This method is automatically invoked by render()

Parameters
g:Graphics

See also

renderGuides()method 
public function renderGuides(g:Graphics):void

Renders all the guide particles within the FisixObject. This method is automatically invoked by render()

Parameters
g:Graphics

See also

renderMagnets()method 
public function renderMagnets(g:Graphics):void

Renders all the magnets within the FisixObject. This method is automatically invoked by render()

Parameters
g:Graphics

See also

renderParticles()method 
public function renderParticles(g:Graphics):void

Renders all the particles within the FisixObject. This method is automatically invoked by render()

Parameters
g:Graphics

See also

renderPolygons()method 
public function renderPolygons(g:Graphics):void

Renders all the polygons within the FisixObject. This method is automatically invoked by render()

Parameters
g:Graphics

See also

renderSurfaces()method 
public function renderSurfaces(g:Graphics):void

Renders all the surfaces within the FisixObject. This method is automatically invoked by render()

Parameters
g:Graphics

See also

rotateAll()method 
public function rotateAll(ang:Number, center:Vector = null):void

Rotates all children of the object by the given angle. Use this method for fixed objects and rotationalThrust() for dynamic objects.

Parameters
ang:Number
 
center:Vector (default = null)

See also

rotationalForce()method 
public function rotationalForce(deg:Number, center:Vector = null):voidParameters
deg:Number
 
center:Vector (default = null)
rotationalThrust()method 
public function rotationalThrust(deg:Number, center:Vector = null):voidParameters
deg:Number
 
center:Vector (default = null)
scale()method 
public function scale(scaleX:Number, scaleY:Number, flipAngularConstraints:Boolean = false, pivot:Vector = null):void

Scales all the objects withing the FisixObject. When scaling, 1 means no scale, 2 200% scale, etc...

Parameters
scaleX:Number — x scale multiplier
 
scaleY:Number — y scale multiplier
 
flipAngularConstraints:Boolean (default = false) — Set this to true if you are flipping your fisix object and it contains angular constraints.
 
pivot:Vector (default = null) — The center point in global space over which to rotate. Leave at null to use the FisixObject's center.
setAllDetectionModes()method 
public function 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. This does not affect the settings of objects added after this call

Parameters
m:int — an integer representing the mode of detection
 
recursive:Boolean (default = true)

See also

setAllReactionModes()method 
public function 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

Parameters
m:int — an integer representing the mode of detection
 
recursive:Boolean (default = true)

See also

setBounce()method 
public function setBounce(b:Number, recursive:Boolean = true):voidParameters
b:Number
 
recursive:Boolean (default = true)
setBounds()method 
public function setBounds(b:BoundingBox):void

Sets the bounding rectangle of all the objects within the FisixObject.

These may be used to contain objects within a certain area Or automatically remove them when they leave the bounds

Parameters
b:BoundingBox — a BoundingBox object

See also

setCenter()method 
public function setCenter(cX:Number, cY:Number, thrustObject:Boolean = false):void

Moves all children of the object so that their center corresponds with the given values.

Parameters
cX:Number — Global x position to be centered at
 
cY:Number — Global y position to be centered at
 
thrustObject:Boolean (default = false) — If true, the movement of the fisix object is treated as a thrust, which adds the movement vector to the velocity. This yields more physically accurate results, but shouldn't be used at instantiation.

See also

setDrag()method 
public function setDrag(d:Number, recursive:Boolean = true):voidParameters
d:Number
 
recursive:Boolean (default = true)
setFixed()method 
public function setFixed(f:Boolean, recursive:Boolean = true):voidParameters
f:Boolean
 
recursive:Boolean (default = true)
setFriction()method 
public function setFriction(f:Number, recursive:Boolean = true):voidParameters
f:Number
 
recursive:Boolean (default = true)
setIterations()method 
public function setIterations(iter:int):void

Sets the amount of times per frame that the collisions and constraints within this object's children should be solved.

Note: The amount of times a fisix object solves itself depends on it's iterations property and it's parent's iterations.
If for example, you set your engine's iterations to 5, and you add a FisixObject and set it's iterations to 6, everything within that fisix object will be solved 30 times, and that's way too much.

More iterations make the object more rigid but also take more proccessing time

Parameters
iter:int — An integer value (starting at 1)
setMagnetic()method 
public function setMagnetic(m:Boolean, recursive:Boolean = true):voidParameters
m:Boolean
 
recursive:Boolean (default = true)
setTraction()method 
public function setTraction(t:Number, recursive:Boolean = true):voidParameters
t:Number
 
recursive:Boolean (default = true)
setVelocity()method 
public function setVelocity(vel:Vector, checkAA:Boolean = true):voidParameters
vel:Vector
 
checkAA:Boolean (default = true)
staticUpdate()method 
protected function staticUpdate():void
thrust()method 
public override function thrust(tX:Number, tY:Number, checkAA:Boolean = true):void

Thrusts all collision objects in the object with the given force

Parameters
tX:Number
 
tY:Number
 
checkAA:Boolean (default = true)

See also

Particle.thrust()
updateDisplays()method 
public function updateDisplays():void

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