Package | com.fileitup.fisixengine.core |
Class | public class FisixObject |
Inheritance | FisixObject ![]() |
Subclasses | FisixEngine, FractalTerrain, Rope |
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
Property | Defined by | ||
---|---|---|---|
![]() | active : 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 | ||
![]() | bounce : 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 | ||
![]() | collidable : 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 | |
![]() | color : 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 | ||
![]() | dynamicObjectCollisions : Boolean = false | CollisionObject | |
fisixObjects : Array an array containing all of the FisixObjects in the FisixObject.
| FisixObject | ||
fisixObjects : Array | FisixObject | ||
![]() | fixed : Boolean A fixed CollisionObject is never influenced by collisions
You may change this value at any time
| CollisionObject | |
![]() | friction : 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 | ||
![]() | inheritAttributesOnAdd : Boolean = true | CollisionObject | |
innerCollisions : Boolean = true When true, objects within the FisixObject will collide with among themselves.
| FisixObject | ||
![]() | lastCollision : CollisionData
An internal object which stores the information of the object's last collision
| CollisionObject | |
![]() | magnetic : 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 | ||
![]() | minX : Number Hold the dimensions of the object's bounding box.
| CollisionObject | |
![]() | name : String = "" | CollisionObject | |
![]() | parent : 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 | ||
![]() | raycast : 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 | ||
![]() | traction : Number = 1 The object's traction.
| CollisionObject | |
![]() | type : String A string representing the type of object you are dealing with
| CollisionObject |
Property | Defined by | ||
---|---|---|---|
bounds : BoundingBox | FisixObject | ||
![]() | detectionMode : int = 0 | CollisionObject | |
iterations : int = 3 | FisixObject | ||
![]() | mFixed : Boolean = false | CollisionObject | |
![]() | mMaterial : String | CollisionObject | |
![]() | mStatic : Boolean = false | CollisionObject | |
![]() | myType : String = "" | CollisionObject | |
![]() | reactionMode : int = 0 | CollisionObject | |
![]() | useRaycasting : Boolean = false | CollisionObject |
Method | Defined by | ||
---|---|---|---|
FisixObject(p:FisixObject = null)
Creates a FisixObject
| FisixObject | ||
![]() |
aabbIntersection(obj:CollisionObject):Boolean
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 | ||
![]() |
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 | ||
Create an explosion in the given position which will affect all the objects within the FisixObject.
| FisixObject | ||
fireAfterChildCollision(child:CollisionObject):void
| FisixObject | ||
![]() |
fireAfterCollision():void
| CollisionObject | |
fireOnChildCollision(child:CollisionObject):void
| FisixObject | ||
![]() |
fireOnCollision():void
| CollisionObject | |
![]() |
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 | ||
![]() |
getDetectionMode():int
| CollisionObject | |
getIterations():int
| FisixObject | ||
![]() |
getMaterial():String
The name of the current material applied to the object
| CollisionObject | |
![]() |
getNormalAngleAt(p:Vector):Number
| CollisionObject | |
![]() | CollisionObject | ||
![]() |
getReactionMode():int
| CollisionObject | |
integrate(dt:Number = 1):void
Integrates all children forward in time.
| FisixObject | ||
![]() |
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 | ||
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 | ||
Creates and adds a StickConstraint in one line.
| FisixObject | ||
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 | ||
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 | ||
![]() |
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 | ||
Applies a force value on the object from the given point.
| FisixObject | ||
Removes a constraint previously added to the FisixObject.
| FisixObject | ||
Removes a Container previously added.
| FisixObject | ||
Use to remove a DisplayAttacher object that was added to the simulation
| FisixObject | ||
Removes a Magnet that was previously added.
| FisixObject | ||
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 | ||
![]() |
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 | ||
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 | ||
setBounds(b:BoundingBox):void
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 | ||
![]() |
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 | ||
![]() |
setMaterial(mName:String):void
Sets the material of the object
This modifies the object's 'friction', 'bounce', 'color' and 'traction' properties.
| CollisionObject | |
![]() |
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 | ||
![]() |
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 | |
![]() |
unload():void
Removes the object from the engine and disposes of it.
| CollisionObject | |
![]() |
updateBoundingBox():void
Updates the bounding box of the object.
| CollisionObject | |
updateDisplays():void
updates all the DisplayAttachers in the engine.
| FisixObject |
Method | Defined by | ||
---|---|---|---|
FisixObject | |||
![]() |
afterCollision(data:CollisionData):void
Override this function to perform an action after a collision is resolved
| CollisionObject | |
![]() |
afterUnload():void
Override this method to perform actions after the object has been unloaded.
| CollisionObject | |
initChild(c:CollisionObject):void
| FisixObject | ||
FisixObject | |||
![]() |
onCollision(data:CollisionData):void
Override this function to perform an action at the time a collision is detected
| CollisionObject | |
![]() |
onUnload():void
Override this method to perform actions once the object is unloaded.
| CollisionObject | |
staticUpdate():void
| FisixObject |
axisAligned | property |
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
bounds | property |
protected var bounds:BoundingBox
boundsCollisions | property |
public var boundsCollisions:Boolean = false
When true, all children of the FisixObject will be confined to the boundaries set by setBounds()
See also
constraints | property |
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.
constraints | property |
public var constraints:Array
containers | property |
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.
containers | property |
public var containers:Array
displayAttachers | property |
public var displayAttachers:Array
drag | property |
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)
fisixObjects | property |
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.
fisixObjects | property |
public var fisixObjects:Array
guides | property |
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.
guides | property |
public var guides:Array
innerCollisions | property |
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
iterations | property |
protected var iterations:int = 3
magnets | property |
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.
magnets | property |
public var magnets:Array
particles | property |
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
particles | property |
public var particles:Array
polygons | property |
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.
renderBoundingBoxes | property |
public var renderBoundingBoxes:Boolean = false
When true, calling render() will also render the bounding boxes of all children objects
See also
surfaces | property |
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.
surfaces | property |
public var surfaces:Array
thrusts | property |
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.
thrusts | property |
public var thrusts:Array
FisixObject | () | constructor |
public function FisixObject(p:FisixObject = null)
Creates a FisixObject
Parametersp: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
addConstraint | () | method |
public function addConstraint(c:Constraint):Constraint
Adds a constraint to the engine from an object previously instanciated.
Parametersc:Constraint — Any objects which extends the Constraint class.This includes SpringConstraints, StickConstraints, and AngularConstraints |
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.
Parametersc:FisixContainer — Any object extending the FisixContainer ObjectThis includes CircleContainers and WheelContainers |
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
Parametersd:DisplayAttacher — An instance of the DisplayAttacher class, or any of its descendents.
return The added object is successful. null if there was an error
|
DisplayAttacher |
addMagnet | () | method |
public function addMagnet(m:Magnet):Magnet
Adds a Magnet Object to the simulation.
Parametersm:Magnet — An instance of the Magnet Class.
|
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
Parametersobj:CollisionObject |
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.
t:Vector — A vector which holds the x and y components of the force to be added
|
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):void
Parameters
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
Parametersf:Vector |
|
checkAA:Boolean (default = true )
|
See also
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.
Parametersstiffness: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
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.
Parameterspos: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 |
fireOnChildCollision | () | method |
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
ReturnsVector |
See also
getIterations | () | method |
public function getIterations():int
Returns
int — the iterations value for this object.
|
See also
initChild | () | method |
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.
Parametersdt: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
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
ParameterstX:Number |
|
tY:Number |
|
recursive:Boolean (default = true )
|
newAngularConstraint | () | method |
public function newAngularConstraint(pA:Particle, pB:Particle, pC:Particle, min:Number = -1, max:Number = -1):AngularConstraint
Parameters
pA:Particle |
|
pB:Particle |
|
pC:Particle |
|
min:Number (default = -1 )
|
|
max:Number (default = -1 )
|
AngularConstraint |
newCircleContainer | () | method |
public function newCircleContainer(x:Number, y:Number, rad:Number, innerDynamics:Boolean = true):CircleContainer
Creates and adds a CircleConstraint in one line.
Parametersx: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 )
|
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.
Parametersx:Number |
|
y:Number |
|
r:Number |
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.
Parametersmc: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.
|
ConstraintAttacher —
The created ConstraintAttacher. null if creation was unsuccessful
|
See also
newDisplayAttacher | () | method |
public function newDisplayAttacher(mc:DisplayObject, v1:Vector, xOffset:Number = 0, yOffset:Number = 0):DisplayAttacher2
Creates and adds a DisplayAttacher to the engine.
Parametersmc: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
|
DisplayAttacher2 —
The created DisplayAttacher. null if creation was unsuccessful
|
See also
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.
Parametersmc: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.
|
DisplayAttacher2 —
The created DisplayAttacher. null if creation was unsuccessful
|
See also
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.
Parametersmc: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.
|
DisplayAttacher3 —
The created DisplayAttacher. null if creation was unsuccessful
|
See also
newDynamicSurface | () | method |
public function newDynamicSurface(pA:Particle, pB:Particle, r:Number = 0):DynamicSurface
Creates and adds a DynamicSurface in one line.
ParameterspA: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
|
DynamicSurface —
If adding was successfull, the object added is returned. Otherwise, null is returned
|
See also
newFisixObject | () | method |
public function newFisixObject():FisixObject
Creates and adds a FisixObject in one line
ReturnsFisixObject —
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.
Parametersx:Number — The x position of the particle
|
|
y:Number — The y position of the particle
|
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.
Parametersforce: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 |
Magnet —
The vector associated with the thrust.
|
See also
newParticleAttacher | () | method |
public function newParticleAttacher(mc:DisplayObject, particle:Particle, xOffset:Number = 0, yOffset:Number = 0):ParticleAttacher
Creates and adds a ParticleAttacher to the engine.
Parametersmc: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
|
ParticleAttacher —
The created ParticleAttacher. null if creation was unsuccessful
|
See also
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.
ParameterspA: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
|
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.
ParameterspA: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
|
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.
ParametersvA: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
|
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.
Parametersmc: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.
|
SurfaceAttacher —
The created SurfaceAttacher. null if creation was unsuccessful
|
See also
newThrust | () | method |
public function newThrust(x:Number, y:Number):Vector
Creates and adds a Thrust in one line.
Parametersx:Number — x force of the thrust
|
|
y:Number — y force of the thrust
|
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.
Parametersmc: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.
|
WheelAttacher —
The created WheelAttacher. null if creation was unsuccessful
|
See also
newWheelContainer | () | method |
public function newWheelContainer(x:Number, y:Number, rad:Number, innerDynamics:Boolean = true):WheelContainer
Parameters
x:Number |
|
y:Number |
|
rad:Number |
|
innerDynamics:Boolean (default = true )
|
WheelContainer |
newWheelParticle | () | method |
public function newWheelParticle(x:Number, y:Number, r:Number):WheelParticle
Creates and adds a WheelParticle in one line.
Parametersx:Number — The x position of the particle
|
|
y:Number — The y position of the particle
|
|
r:Number — The radius of the particle
|
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):void
Parameters
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
Parametersx:Number — The radius to search for a hit at. This is usefull for picking small objects.
|
|
y:Number |
|
radius:Number (default = 0 )
|
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.
Parameterspoint:Vector |
|
force:Number |
removeConstraint | () | method |
public function removeConstraint(c:Constraint, disposeObject:Boolean = false):Constraint
Removes a constraint previously added to the FisixObject.
Parametersc:Constraint — Any object that extends the Constraint class.
|
|
disposeObject:Boolean (default = false )
|
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.
Parametersc:FisixContainer |
|
disposeObject:Boolean (default = false )
|
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
Parametersd:DisplayAttacher |
DisplayAttacher |
removeMagnet | () | method |
public function removeMagnet(m:Magnet, disposeObject:Boolean = false):Magnet
Removes a Magnet that was previously added.
Parametersm:Magnet |
|
disposeObject:Boolean (default = false )
|
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
Parametersobj:CollisionObject |
|
disposeObject:Boolean (default = false )
|
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()
Parameterst:Vector |
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
Parametersg:Graphics |
See also
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()
Parametersg: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()
Parametersg: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()
Parametersg: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()
Parametersg: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()
Parametersg: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()
Parametersg: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()
Parametersg: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.
Parametersang:Number |
|
center:Vector (default = null )
|
See also
rotationalForce | () | method |
public function rotationalForce(deg:Number, center:Vector = null):void
Parameters
deg:Number |
|
center:Vector (default = null )
|
rotationalThrust | () | method |
public function rotationalThrust(deg:Number, center:Vector = null):void
Parameters
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...
ParametersscaleX: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
Parametersm: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
Parametersm:int — an integer representing the mode of detection
|
|
recursive:Boolean (default = true )
|
See also
setBounce | () | method |
public function setBounce(b:Number, recursive:Boolean = true):void
Parameters
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
Parametersb: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.
ParameterscX: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):void
Parameters
d:Number |
|
recursive:Boolean (default = true )
|
setFixed | () | method |
public function setFixed(f:Boolean, recursive:Boolean = true):void
Parameters
f:Boolean |
|
recursive:Boolean (default = true )
|
setFriction | () | method |
public function setFriction(f:Number, recursive:Boolean = true):void
Parameters
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
iter:int — An integer value (starting at 1)
|
setMagnetic | () | method |
public function setMagnetic(m:Boolean, recursive:Boolean = true):void
Parameters
m:Boolean |
|
recursive:Boolean (default = true )
|
setTraction | () | method |
public function setTraction(t:Number, recursive:Boolean = true):void
Parameters
t:Number |
|
recursive:Boolean (default = true )
|
setVelocity | () | method |
public function setVelocity(vel:Vector, checkAA:Boolean = true):void
Parameters
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
ParameterstX:Number |
|
tY:Number |
|
checkAA:Boolean (default = true )
|
See also
updateDisplays | () | method |
public function updateDisplays():void
updates all the DisplayAttachers in the engine. This method is invoked automatically by the engine.