| Property | Defined by | ||
|---|---|---|---|
| defaultSolver : Class [write-only]
| Foam | ||
| engine : PhysicsEngine
[read-only]
| Foam | ||
| simulatables : Array [read-only]
| Foam | ||
| solverIterations : int [write-only]
| Foam | ||
| timestep : Number | Foam | ||
| Method | Defined by | ||
|---|---|---|---|
|
Foam()
Creates a new FOAM interface
This is most likely the first step in creating a physics simulation.
| Foam | ||
|
addElement(element:ISimulatable, collide:Boolean = true, render:Boolean = true, renderData:* = null, solver:IODESolver = null):void
Adds an element to the simulation
This will probably be the most used method- it handles a lot of the logic necessary to give the user a lot of control without worrying about dividing up the element to its respective places in the application. | Foam | ||
|
addGlobalForceGenerator(forceGenerator:IForceGenerator, applyToExisting:Boolean = true):void
Adds a global force to the simulation
This force will be added to all future and current (as defined by applyToExisting) elements | Foam | ||
|
addRenderable(renderable:Renderable):void
Adds a renderable element to the renderer
| Foam | ||
|
removeElement(element:ISimulatable):void
Removes an element from the simulation
This removes the element from the renderer and the engine. | Foam | ||
|
removeGlobalForceGenerator(forceGenerator:IForceGenerator, remainInEffect:Boolean = false):void
Removes a global force from the simulation
This force will be removed from all elements its currently generating for depending on remainInEffect | Foam | ||
|
setCoarseCollisionDetector(detector:ICoarseCollisionDetector):void
Sets the engine's coarse collision detector
| Foam | ||
|
setCollisionFactory(factory:ICollisionFactory):void
Defines the collision factory used by the coarse detector to return IFineCollisionDetectors
| Foam | ||
|
setRenderer(renderer:IFoamRenderer):void
Sets the renderer
| Foam | ||
|
simulate():void
Starts running the simulation
| Foam | ||
|
stepBackward(event:Event = null):void
| Foam | ||
|
stepForward(event:Event = null):void
| Foam | ||
|
stop():void
Stops the simulation
| Foam | ||
|
stopColliding(element:ISimulatable):void
Removes an element from collision consideration
| Foam | ||
|
stopDrawing(element:*):void
Stops an element from being rendered.
| Foam | ||
|
stopSimulating(element:ISimulatable):void
Stops an element from being simulated
Note that this does not stop an element from being rendered. | Foam | ||
|
useMouseDragger(value:Boolean):void
Depicts whether to use the MouseSpring on bodies or not
| Foam | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Foam | ||||
| Constant | Defined by | ||
|---|---|---|---|
| DEFAULT_ODE_SOLVER : Class [static] offers a default solver class for differential equations
| Foam | ||
| STEP : String = "step" [static] step event
| Foam | ||
| defaultSolver | property |
defaultSolver:Class [write-only]Implementation
public function set defaultSolver(value:Class):void
| engine | property |
| simulatables | property |
simulatables:Array [read-only]Implementation
public function get simulatables():Array
| solverIterations | property |
solverIterations:int [write-only]Implementation
public function set solverIterations(value:int):void
| timestep | property |
timestep:Number [read-write]Implementation
public function get timestep():Number
public function set timestep(value:Number):void
| Foam | () | constructor |
public function Foam()Creates a new FOAM interface This is most likely the first step in creating a physics simulation.
| addElement | () | method |
public function addElement(element:ISimulatable, collide:Boolean = true, render:Boolean = true, renderData:* = null, solver:IODESolver = null):voidAdds an element to the simulation
This will probably be the most used method- it handles a lot of the logic necessary to give the user a lot of control without worrying about dividing up the element to its respective places in the application.
//creates a new instance of Foam var foam:Foam = new Foam(); //creates a triangle at x:100, y:100 with a mass of 100 (ShapeUtil.createSymmetricPolygon defaults to 3 vertices) var body:RigidBody = new RigidBody( 100, 100, 100, ShapeUtil.createSymmetricPolygon() ); //adds the body to FOAM for simulation foam.addElement( body );Parameters
element:ISimulatable — ISimulatable to add
|
|
collide:Boolean (default = true) — defines whether this element should be tested for collision during simulation
|
|
render:Boolean (default = true) — defines whether this element should be drawn
|
|
renderData:* (default = null) — a unique object to be interpreted by your IFoamRenderer and associated with this element
|
|
solver:IODESolver (default = null) — IODESolver to use to advance the state of this element
|
See also
| addGlobalForceGenerator | () | method |
public function addGlobalForceGenerator(forceGenerator:IForceGenerator, applyToExisting:Boolean = true):voidAdds a global force to the simulation
This force will be added to all future and current (as defined by applyToExisting) elements
ParametersforceGenerator:IForceGenerator — IForceGenerator to add
|
|
applyToExisting:Boolean (default = true) — whether to add this force generator to all
elements already added to FOAM
|
See also
| addRenderable | () | method |
public function addRenderable(renderable:Renderable):voidAdds a renderable element to the renderer
Parametersrenderable:Renderable — Renderable to add
|
See also
| removeElement | () | method |
public function removeElement(element:ISimulatable):voidRemoves an element from the simulation
This removes the element from the renderer and the engine.
Parameterselement:ISimulatable — ISimulatable to remove
|
See also
| removeGlobalForceGenerator | () | method |
public function removeGlobalForceGenerator(forceGenerator:IForceGenerator, remainInEffect:Boolean = false):voidRemoves a global force from the simulation
This force will be removed from all elements its currently generating for depending on remainInEffect
ParametersforceGenerator:IForceGenerator — IForceGenerator to remove
|
|
remainInEffect:Boolean (default = false) — whether to allow it to keep generating, but remove
it from new additions to FOAM, or remove it from all affected ISimulatables
|
See also
| setCoarseCollisionDetector | () | method |
public function setCoarseCollisionDetector(detector:ICoarseCollisionDetector):voidSets the engine's coarse collision detector
Parametersdetector:ICoarseCollisionDetector — ICoarseCollisionDetector to handle broad phase culling
|
| setCollisionFactory | () | method |
public function setCollisionFactory(factory:ICollisionFactory):voidDefines the collision factory used by the coarse detector to return IFineCollisionDetectors
Parametersfactory:ICollisionFactory — CollisionFactory
|
| setRenderer | () | method |
public function setRenderer(renderer:IFoamRenderer):voidSets the renderer
Parametersrenderer:IFoamRenderer |
See also
| simulate | () | method |
public function simulate():voidStarts running the simulation
See also
| stepBackward | () | method |
public function stepBackward(event:Event = null):voidParameters
event:Event (default = null) |
| stepForward | () | method |
public function stepForward(event:Event = null):voidParameters
event:Event (default = null) |
| stop | () | method |
| stopColliding | () | method |
public function stopColliding(element:ISimulatable):voidRemoves an element from collision consideration
Parameterselement:ISimulatable — element to remove
|
See also
| stopDrawing | () | method |
public function stopDrawing(element:*):voidStops an element from being rendered.
Note that this does not stop the element from simulation when called by itself.
Parameterselement:* — element to remove
|
| stopSimulating | () | method |
public function stopSimulating(element:ISimulatable):voidStops an element from being simulated
Note that this does not stop an element from being rendered. It does, however remove it from collision consideration. Also, the simulation is stopped if there is nothing left to simulate.
Parameterselement:ISimulatable — element to remove from simulation
|
| useMouseDragger | () | method |
public function useMouseDragger(value:Boolean):voidDepicts whether to use the MouseSpring on bodies or not
Parametersvalue:Boolean — true to use the dragger, false otherwise
|
| step | event |
| DEFAULT_ODE_SOLVER | constant |
public static const DEFAULT_ODE_SOLVER:Classoffers a default solver class for differential equations
| STEP | constant |
public static const STEP:String = "step"step event