Packagecom.fileitup.fisixengine.resources
Classpublic class FractalTerrain
InheritanceFractalTerrain Inheritance FisixObject Inheritance CollisionObject

A modified FisixObject which, on instantiation, creates a fractal terrain within itself, composed of static surfaces. Once the terrain is created, its attributes like height and smoothness cannot be changed.



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
 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
 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
  surfacePoints : Array
All the Vectors used to represent the terrain
FractalTerrain
 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
  
FractalTerrain(start:Vector, end:Vector, height:Number, smooth:Number = 2, levels:int = 5, thickness:Number = 0, surfaceNormal:Vector = null, staticTerrain:Boolean = true)
Creates a FractalTerrain It is important to note that the terrain will be created from left to right, so providing a start point to the right of the end point will create an upside-down terrain.
FractalTerrain
 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
 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
 Inherited
dispose():void
FisixObject
 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
 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
 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
 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
 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
 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
 Inherited
setFriction(f:Number, recursive:Boolean = true):void
FisixObject
 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
 Inherited
setTraction(t:Number, recursive:Boolean = true):void
FisixObject
 Inherited
setVelocity(vel:Vector, checkAA:Boolean = true):void
FisixObject
 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
 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
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
surfacePointsproperty
public var surfacePoints:Array

All the Vectors used to represent the terrain

Constructor detail
FractalTerrain()constructor
public function FractalTerrain(start:Vector, end:Vector, height:Number, smooth:Number = 2, levels:int = 5, thickness:Number = 0, surfaceNormal:Vector = null, staticTerrain:Boolean = true)

Creates a FractalTerrain It is important to note that the terrain will be created from left to right, so providing a start point to the right of the end point will create an upside-down terrain.

Parameters
start:Vector — The point in global space at which to start the terrain.
 
end:Vector — The point in global space at which to end the terrain.
 
height:Number — The maximum height of the terrain
 
smooth:Number (default = 2) — A value 1 or higher that represents the smoothness of the terrain. The higher this value, the less jagged the terrain will be.
 
levels:int (default = 5) — The higher this number, the more detailed the terrain will be. Setting this number too high may cause you application to crash because of the fractal terrain algorithm's recursive nature.
 
thickness:Number (default = 0) — The thickness of the surfaces created for the terrain.
 
surfaceNormal:Vector (default = null) — Leave this null for automatic normal detection, or change it to affect the way the terrain is oriented. For example, providing the argument - new Vector(0,1) will make sure that the terrain always points up.
 
staticTerrain:Boolean (default = true) — Whether or not the terrain should be made static. If the terrain will never move, it is recommended that it be made static.