ODD.PhysLite: Functions Types Modinfo Source  

Miscellaneous/PhysLite

Functions Summary

AdvBodyApplyToAll Maps one function to all TAdvBodies.
AdvBodyCountAll Counts all TAdvBodies.
AdvBodyLoad Loads a previously saved advanced body object.
ColEventCreate Creates a collision event object.
ColEventEmit Emits a collision event.
ColEventFlush Clears the collision event queue.
ColEventGetCurrent Gets the last polled collision event.
ColEventPeek Gets the next collision event from the queue.
ColEventPoll Removes the next collision event from the queue.
ColEventPost Posts a collision event to the collision events queue.
ColEventSeek Gets the collision event associated with two objects.
ColEventSetMode Sets how collision events are added to the event queue.
ConApplyToActive Maps one function to all active TConstraints.
ConCountActive Counts the number of active TConstraints.
ConCreate Creates a new TConstraint object.
MassApplyToActive Maps one function to all active TMass objects.
MassCountActive Counts the number of active TMass objects.
MassCreate Creates a mass object.
PhysicsBegin Creates a new physics simulation.
PhysicsDrawImage Draws an image.
PhysicsDrawLine Draws a line.
PhysicsDrawOval Draws an oval.
PhysicsDrawPoly Draws a polygon.
PhysicsDrawRect Draws a rectangle.
PhysicsEnd Ends the physics simulation.
PhysicsGetBounds Get the upper and lower bounds of the simulation.
PhysicsMouseX Gets the mouse X coordinate.
PhysicsMouseY Gets the mouse Y coordinate.
PhysicsScreenX Gets the screen x coordinate.
PhysicsScreenY Gets the screen y coordinate.
PhysicsSetBounds Set the upper and lower bounds of the simulation.
PhysicsSetDrawCoords Set the area of simulation to draw.
PhysicsSetDrawRotation Sets the angle at which to draw the simulation.
PhysicsSetDrawZoom Set the zoom of the draw commands.
PhysicsSetFriction Set the friction of the simulations bounds.
PhysicsSetGravity Sets the simulation gravity.
PhysicsSetGridSize Set the size of the shifted grid.
PhysicsSetIterations The number of iterations used by the simulation.
PhysicsSimX Gets the simulation X coordinate of a screen x,y location.
PhysicsSimY Gets the simulation Y coordinate of a screen x,y location.
PhysicsUpdate Update simulation.
PhysicsUpdateTransform Updates the transform/rotation matrix.
PhysicsUseSGrid Activate or de-activate the use of the shifted grid for TMass occlusion.
RigCreate Creates a new TRig.
ZoneApplyToActive Maps one function to all active TZones.
ZoneCountActive Counts the number of active TZones.
ZoneCreate Creates a new collision zone.
ZoneLoad Loads a saved collision zone.

Types Summary

TAdvBody Advanced Body object.
TBody TBody object.
TColEvent Collision Event object.
TConstraint Constraint object.
TMass Mass object.
TPhysics Physics simulation object.
TRig TRig object.
TZone Collision zone object.

Functions

Function AdvBodyApplyToAll( ApplyFunc( advBody:TAdvBody ) )
DescriptionMaps one function to all TAdvBodies.
InformationApplyFunc is the function that will be run for every active TAdvBody in the simulation.

Function AdvBodyCountAll:Int()
ReturnsThe number of TAdvBodies.
DescriptionCounts all TAdvBodies.
InformationAdvBodyCountAll will include TAdvBodies that are not active.

Function AdvBodyLoad:TAdvBody( url:Object, active:Int=False )
ReturnsLoaded TAdvBody.
DescriptionLoads a previously saved advanced body object.
InformationThe Load function loads a TAdvBody that has previously been saved using the Save method. The active parameter determines if the TAdvBody will be Activated immediately after loading.

The loaded TAdvBody will be identical to the original, however collision groups need a little further explination. If a mass was created using an absolute value for it's colGroup, i.e. 0 or above, then the corrisponding loaded mass will have the exact same colGroup. If however the original mass was created using -1 as it's colGroup the loaded mass will be given the next unique colGroup. Masses within the same TAdvBody that share the same colGroup will keep those associations after loading.


Function ColEventCreate:TColEvent( obj1:TMass, obj2:Object, x:Float, y:Float, force:Float )
ReturnsThe created collision event.
DescriptionCreates a collision event object.
InformationCraetes a collision event that can then be emitted or posted.

See Also: ColEventEmit and ColEventPost.


Function ColEventEmit( colEvent:TColEvent )
DescriptionEmits a collision event.
InformationWhen a collision event is emitted all hooked functions are run and then the event is posted to the event queue. If the hook functions return Null then the collision event will not be posted to the event queue. Emitting is usually handled automatically by PhysicsUpdate but ColEventEmit can be used to fake a collision event.

See Also: ColEventCreate and ColEventPost.


Function ColEventFlush()
DescriptionClears the collision event queue.
InformationAfter a call to ColEventFlush the functions ColEventPoll, ColEventPeek, ColEventSeek and ColEventGetCurrent will all return Null. PhysicsUpdate will automatically ColEventFlush the collision event queue ready to make a new one.

Function ColEventGetCurrent:TColEvent()
Returnsthe last polled collision event.
DescriptionGets the last polled collision event.
InformationIf no collision event has been polled yet or an empty queue has been polled then ColEventGetCurrent returns Null.

Function ColEventPeek:TColEvent()
ReturnsThe next collision event.
DescriptionGets the next collision event from the queue.
InformationSimilar to ColEventPoll, however ColEventPeek does not remove the event from the queue.

See Also: ColEventPoll, ColEventSeek and CollEventGetCurrent.


Function ColEventPoll:TColEvent()
ReturnsThe next collision event in the queue.
DescriptionRemoves the next collision event from the queue.
InformationColEventPoll sequentially removes collision events from the queue, and sets it to the current event. If there are no more events in the queue then ColEventPoll returns Null.

See Also: ColEventPeek, ColEventSeek and CollEventGetCurrent.


Function ColEventPost( colEvent:TColEvent, update:Int=TColEvent.MODE_UPDATE )
DescriptionPosts a collision event to the collision events queue.
InformationSimilar to ColEventEmit, ColEventPost will add a collision event to the collision event queue. However posted collision events will not run any hooked functions. The update parameter is used to tell PhysLite to either update or replace previous collisions between the same objects. See ColEventSetMode for more information on modes.

Function ColEventSeek:TColEvent( colObj1:Object, colObj2:Object=Null )
ReturnsThe collision event found.
DescriptionGets the collision event associated with two objects.
InformationColEventSeek finds the collision event associated with two objects. One of the parameters must be a TMass the other can be either a TMass or TZone. Alternatively leaving the second parameter as Null will check for a collision with the simulation bounds. The returned collision event will not be removed from the queue, and collisions that have already been polled can still be found using ColEventSeek. If no collision occured between the two objects then ColEventSeek returns Null.

See Also: ColEventPoll and ColEventSeek.


Function ColEventSetMode( value:Int )
DescriptionSets how collision events are added to the event queue.
InformationSets the way collision events are added to the event queue. If there is more than one iteration then it is possible for two objects to collide more than once during the same update. SetMode tells PhysLite how to report multiple collision between the same objects. Value can be one of the following values, MODE_DISCARD, MODE_UPDATE or MODE_REPLACE.

MODE_DISCARDNo events are added to the event queue. Hooked functions will still be called. Setting MODE_DISCARD will give a speed increase. It is also useful for making your own custom event queue using hook functions.
MODE_UPDATETotals the force of multiple collisions between the same objects. This is the default mode.
MODE_REPLACEDiscard previous collision events between the same two objects and only report the last.


Function ConApplyToActive( ApplyFunc( con:TConstraint ) )
DescriptionMaps one function to all active TConstraints.
InformationApplyFunc is the function that will be run for every active TConstraint in the simulation.

Function ConCountActive:Int()
ReturnsThe number of active TConstraints.
DescriptionCounts the number of active TConstraints.
InformationConCountActive only counts TConstraints that are associated with a TBody.

Function ConCreate:TConstraint( m1:TMass, m2:TMass, restLength:Float=-1, stiffness:Float=1.0 )
ReturnsCreated TConstraint.
DescriptionCreates a new TConstraint object.
InformationA constraint is an invisible conection between two TMasses. restLength is the length of the constraint. Setting restLength to -1 results in restLength being calculated based on the current distance between the two masses.

Function MassApplyToActive( ApplyFunc( mass:TMass ) )
DescriptionMaps one function to all active TMass objects.
InformationApplyFunc is the function that will be run for every active TMass in the simulation.

Function MassCountActive:Int()
ReturnsThe number of active TMass objects.
DescriptionCounts the number of active TMass objects.
InformationMassCountActive only counts TMass objects that are associated with an active TConstraint.

Function MassCreate:TMass( x:Float, y:Float, mass:Float, radius:Float, friction:Float, colGroup:Int=-1 )
ReturnsCreated TMass.
DescriptionCreates a mass object.
InformationThe Create function creates a TMass to be used by the simulation. The TMass does not become active until it is assigned to an active TConstraint. The parameter colGroup is the masses collision group. A value of -1 will set the masses collision group to the next unique value. If two collidable objects have the same collision group then they will not collide with each other. If colGroup is set to 0 then the mass will not collide with any other object.

Function PhysicsBegin:TPhysics( width:Float, height:Float, gravY:Float, gravX:Float=0.0, i:Int=1 )
ReturnsA TPhysics object.
DescriptionCreates a new physics simulation.
InformationCreates a new physics simulation, which can be stepped through using PhysicsUpdate.

Note: that the gravity gravY parameter is before the gravX parameter.

See Also: PhysicsUpdate, PhysicsSetBounds, PhysicsSetGravity, PhysicsSetIterations and PhysicsEnd.


Function PhysicsDrawImage( image:TImage, x:Float, y:Float, frame:Int=0 )
DescriptionDraws an image.
InformationDraws an image at simulation coordinates x,y and with the correct rotation.

See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsDrawPoly, PhysicsDrawRect, PhysicsDrawLine and PhysicsDrawOval.


Function PhysicsDrawLine( x:Float, y:Float, x2:Float, y2:Float )
DescriptionDraws a line.
InformationDraws a line at the correct simulation coordinates.

See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsDrawImage, PhysicsDrawPoly, PhysicsDrawRect and PhysicsDrawOval.


Function PhysicsDrawOval( x:Float, y:Float, width:Float, height:Float )
DescriptionDraws an oval.
InformationDraws an oval at simulation coordinates x,y and with the correct rotation.

See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsDrawImage, PhysicsDrawPoly, PhysicsDrawRect and PhysicsDrawLine.


Function PhysicsDrawPoly( xy:Float[], x:Float=0.0, y:Float=0.0 )
DescriptionDraws a polygon.
InformationDraws a polygon at simulation coordinates x,y and with the correct rotation.

See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsDrawImage, PhysicsDrawRect, PhysicsDrawLine and PhysicsDrawOval.


Function PhysicsDrawRect( x:Float, y:Float, width:Float, height:Float )
DescriptionDraws a rectangle.
InformationDraws a rectangle at simulation coordinates x,y and with the correct rotation.

See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsDrawImage, PhysicsDrawPoly, PhysicsDrawLine and PhysicsDrawOval.


Function PhysicsEnd()
DescriptionEnds the physics simulation.
InformationSee Also: PhysicsBegin.

Function PhysicsGetBounds( lowerX:Float Var, lowerY:Float Var, upperX:Float Var, upperY:Float Var )
DescriptionGet the upper and lower bounds of the simulation.
InformationSee Also: PhysicsSetBounds.

Function PhysicsMouseX:Float()
ReturnsMouse X coordinate.
DescriptionGets the mouse X coordinate.
InformationMouseX returns the simulation X coordinate of the mouse cursor.

See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseY, PhysicsSimX, PhysicsSimY, PhysicsScreenX and PhysicsScreenY.


Function PhysicsMouseY:Float()
ReturnsMouse Y coordinate.
DescriptionGets the mouse Y coordinate.
InformationMouseY returns the simulation Y coordinate of the mouse cursor.

See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsSimX, PhysicsSimY, PhysicsScreenX and PhysicsScreenY.


Function PhysicsScreenX:Float( valueX:Float, valueY:Float )
ReturnsThe screen x coordinate of simulation x,y coordinate.
DescriptionGets the screen x coordinate.
InformationSee Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsSimY and PhysicsScreenY.

Function PhysicsScreenY:Float( valueX:Float, valueY:Float )
ReturnsThe screen y coordinate of simulation x,y coordinate.
DescriptionGets the screen y coordinate.
InformationSee Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsSimY and PhysicsScreenX.

Function PhysicsSetBounds( lowerX:Float, lowerY:Float, upperX:Float, upperY:Float )
DescriptionSet the upper and lower bounds of the simulation.
InformationSee Also: PhysicsGetBounds and PhysicsSetFriction.

Function PhysicsSetDrawCoords( centerX:Float, centerY:Float )
DescriptionSet the area of simulation to draw.
InformationcenterX and centerY are the simulation coordinates to be mapped to the center of the screen.

See Also: PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsSimY, PhysicsDrawImage, PhysicsDrawPoly, PhysicsDrawRect, PhysicsDrawLine, PhysicsDrawOval, PhysicsScreenX and PhysicsScreenY.


Function PhysicsSetDrawRotation( angle:Float=0.0 )
DescriptionSets the angle at which to draw the simulation.
InformationSetDrawRotation rotates all drawing commands in PhysLite. Use the drawing commands within PhysLite to draw in the corrrect simulation location. SetDrawRotation does not affect the ordinary Max2D drawing commands.

See Also: PhysicsSetDrawZoom, PhysicsSetDrawCoords, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsSimY, PhysicsDrawImage, PhysicsDrawPoly, PhysicsDrawRect, PhysicsDrawLine, PhysicsDrawOval, PhysicsScreenX and PhysicsScreenY.


Function PhysicsSetDrawZoom( zoom:Float=1.0 )
DescriptionSet the zoom of the draw commands.
InformationPhysicsSetDrawZoom scales all the physics drawing functions by zoom.

See Also: PhysicsSetDrawCoords, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsSimY, PhysicsDrawImage, PhysicsDrawPoly, PhysicsDrawRect, PhysicsDrawLine, PhysicsDrawOval, PhysicsScreenX and PhysicsScreenY.


Function PhysicsSetFriction( frict:Float )
DescriptionSet the friction of the simulations bounds.
InformationSee Also: PhysicsSetBounds.

Function PhysicsSetGravity( x:Float, y:Float )
DescriptionSets the simulation gravity.
InformationGravity can go in any direction dictated by the vector x, y.

Function PhysicsSetGridSize( value:Int )
DescriptionSet the size of the shifted grid.
InformationThe shifted grid size can be in the range of 8-64. When using the shifted grid, setting the size of the grid too high can make the simulation unstable. To make sure that the grid is not set too high use the following equation, (maxBound-minBound)/diam, Where minBound and maxBound are the dimensions of the smallest side of the simulation area, and diam is the diameter(radius*2) of the largest TMass in the simulation. Even this equation will create a shifted grid size right on the limit so it is probably best to use this equation as an absolute maximum.

See Also: PhysicsUseSGrid.


Function PhysicsSetIterations( i:Int )
DescriptionThe number of iterations used by the simulation.
InformationThe higher the value the more accurate and stiff the simulation. The lower the value then the faster and softer the simulation.

Function PhysicsSimX:Float( x:Float, y:Float )
ReturnsSimulation X coordinate.
DescriptionGets the simulation X coordinate of a screen x,y location.
InformationSee Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimY, PhysicsDrawOval, PhysicsScreenX and PhysicsScreenY.

Function PhysicsSimY:Float( x:Float, y:Float )
ReturnsSimulation Y coordinate.
DescriptionGets the simulation Y coordinate of a screen x,y location.
InformationSee Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsScreenX and PhysicsScreenY.

Function PhysicsUpdate()
DescriptionUpdate simulation.
InformationProcess the physics iterations and responses. PhysicsUpdate will Flush the event collision queue, and repopulate it.

See Also: PhysicsBegin and PhysicsEnd.


Function PhysicsUpdateTransform()
DescriptionUpdates the transform/rotation matrix.
InformationUnder normal circamstances PhysicsUpdateTransform will not be needed as the transform/rotation matrix is update by any commands that would change it. However, PhysicsUpdateTransform is required when the display dimensions are changed, and it becomes indespensable when using a MaxGUI canvas.

See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsSimY, PhysicsDrawImage, PhysicsDrawPoly, PhysicsDrawRect, PhysicsDrawLine, PhysicsDrawOval, PhysicsScreenX and PhysicsScreenY.


Function PhysicsUseSGrid( value:Int )
DescriptionActivate or de-activate the use of the shifted grid for TMass occlusion.
InformationSet to true to use the shifted grid to occlude TMass objects. The shifted grid occlusion is not used by default. The shifted grid gives the best performance when used with extremely large simulations, and will actually be slower on very small simulations. For more information see PhysicsSetGridSize.

See Also: PhysicsSetGridSize.


Function RigCreate:TRig( image:TImage, mass:TMass, con:TConstraint=Null, angle:Float=0 )
ReturnsCreated TRig.
DescriptionCreates a new TRig.
InformationCreates a rig attached to mass and orientated relative to con. angle is how much the images orientation is offset. If con is Null then the image is orientated only by angle.

Function ZoneApplyToActive( ApplyFunc( zone:TZone ) )
DescriptionMaps one function to all active TZones.
InformationApplyFunc is the function that will be run for every active TZone in the simulation.

Function ZoneCountActive:Int()
ReturnsThe number of active TZones.
DescriptionCounts the number of active TZones.
InformationZoneCountActive only counts TZones that have been activated.

Function ZoneCreate:TZone( area:Float[], style:Int=TZone.LINE, frict:Float=1.0, colGroup:Int=-1, qtLevel:Int=1 )
ReturnsCollision zone created.
DescriptionCreates a new collision zone.
InformationA collision zone is an area of the simulation that masses can collide with. The collision area is difined by an array of x:Float,y:Float coordinate pairs.

Style can be either LINE, LOOP, FILL, or HOLE.

colGroup relates to which masses will collide with the zone. See MassCreate for more information.

qtLevel is the number of levels in the zones QuadTree. A value of 1 is the same as having bounding checks and is sufficient in most cases. QuadTree creation is slow so setting qtLevel too high can cause massive delays in an application.


Function ZoneLoad:TZone( url:Object )
ReturnsLoaded collision zone.
DescriptionLoads a saved collision zone.
Informationurl is the file where the TZone is saved. The zones QuadTree is also loaded so does not need to be recalculated.

Types

Type TAdvBody Extends TBody
DescriptionAdvanced Body object.
Methods Summary
Activate Activates the TAdvBody.
CleanIndex Removes blank indices from the TAdvBody.
CollideAdvBody Retrieves the collisions between TAdvBody's.
CollideBounds Retreives all the collisions between the TAdvBody and the simulations bounds.
CollideZone Retreives all the collisions between the TAdvBody and a TZone.
ConAdd Creates and adds a constraint to the TAdvBody.
ConAddAll A shortcut method to connect all the masses in a TAdvBody.
ConCleanIndex Condenses the indices of the constraints.
ConExists Sees if constraint exists.
ConGet Gets a TConstraint component.
ConMaxIndex Get the maximum constraint index used by the TAdvBody.
ConRemove Removes a constraint from the TAdvBody.
ConSwapIndex Swaps the index positions of two constraints.
Copy Copies the advanced body object.
DeActivate Deactivates the TAdvBody.
Draw Draws the TAdvBody.
Free Frees the TAdvBody.
Freeze Freezes all the bodies masses.
GetPosition Gets the position of the TAdvBody.
GetRotation Gets the angle of the TAdvBody.
GetX Gets the X coordinate of the TAdvBody position.
GetY Gets the Y coordinate of the TAdvBody position.
ImageAdd Adds an image to the TAdvBody.
ImageCleanIndex Condenses the indices of the images.
ImageExists Sees if image exists.
ImageGet Gets the image at index.
ImageMaxIndex Get the maximum image index used by the TAdvBody.
ImageRemove Removes an image from the TAdvBody.
ImageReplace Replaces one image with another.
ImageSwapIndex Swaps the index positions of two rigs.
MassAdd Creates and adds a mass to the TAdvBody.
MassCleanIndex Condenses the indices of the masses.
MassExists Sees if mass exists.
MassGet Gets a TMass component.
MassMaxIndex Get the maximum mass index used by the TAdvBody.
MassRemove Removes a mass from the TAdvBody.
MassSwapIndex Swaps the index positions of two masses.
Move Moves the TAdvBody.
Position Position the TAdvBody.
RigAdd Creates and adds a rig to the TAdvBody.
RigCleanIndex Condenses the indices of the rigs.
RigExists Sees if rig exists.
RigGet Gets a TRig component.
RigMaxIndex Get the maximum rig index used by the TAdvBody.
RigRemove Removes a rig from the TAdvBody.
RigSwapIndex Swaps the index positions of two rigs.
Rotate Rotates TAdvBody.
Save Saves the advanced body object.
Spin Spins the TAdvBody.
Thaw Thaws all the bodies masses.
Translate Translates the TAdvBody.
Turn Turns the TAdvBody.
Functions Summary
ApplyToAll Maps one function to all TAdvBodies.
CountAll Counts all TAdvBodies.
Load Loads a previously saved advanced body object.
Method Activate()
DescriptionActivates the TAdvBody.
InformationWhen created a TAdvBody is not active within the simulation. Using Activate is the equivilant of assigning all the constraints within the TAdvBody.

See Also: DeActivate.

Method CleanIndex()
DescriptionRemoves blank indices from the TAdvBody.
InformationCleanIndex condenses the mass, con, rig and image indices of the TAdvBody. This means that all gaps(blank index places) are filled by higher indexed components.

Note: After using CleanIndex the index values of each component may have changed.

Method CollideAdvBody:TList( advbody:TAdvBody )
ReturnsA list of Collision Events.
DescriptionRetrieves the collisions between TAdvBody's.
InformationChecks for collisions between the TMass objects of two Advanced Bodys and returns a list of all the TColEvent objects.

See Also: CollideZone, CollideBounds and TColEvent.

Method CollideBounds:TList()
ReturnsA list of Collision Events.
DescriptionRetreives all the collisions between the TAdvBody and the simulations bounds.
InformationChecks for collisions between the TMass objects of the TAdvBody and the simulation bounds, and returns a list of all the TColEvent objects.

See Also: CollideAdvBody, CollideZone and TColEvent.

Method CollideZone:TList( zone:TZone )
ReturnsA list of Collision Events.
DescriptionRetreives all the collisions between the TAdvBody and a TZone.
InformationChecks for collisions between the TMass objects of the TAdvBody and a TZone, and returns a list of all the TColEvent objects.

See Also: CollideAdvBody, CollideBounds and TColEvent.

Method ConAdd:Int( mIndex1:Int, mIndex2:Int, restLength:Float=-1, stiffness:Float=1.0 )
ReturnsThe index of the created constraint.
DescriptionCreates and adds a constraint to the TAdvBody.
InformationCreates a constraint associated with the TAdvBody and returns it's index. mIndex1 and mIndex2 are the indices of the two masses to be constrained. See Create for more information.
Method ConAddAll( stiffness:Float=1.0 )
DescriptionA shortcut method to connect all the masses in a TAdvBody.
InformationConAddAll does not make efficient TAdvBodys and should be used sparingly. ConAddAll also does not take into account already created constraints and will result in these being duplicated.
Method ConCleanIndex()
DescriptionCondenses the indices of the constraints.
InformationConCleanIndex removes gaps in the index list. It should be noted that constraints index values will be changed by this method.
Method ConExists:Int( index:Int )
ReturnsTrue if constraint exists, false if otherwise.
DescriptionSees if constraint exists.
InformationNot all indices within the index range are used by a TAdvBody. Use ConExists to see if index is currently in use.
Method ConGet:TConstraint( index:Int )
ReturnsThe TConstraint at index.
DescriptionGets a TConstraint component.
InformationConGet returns the TConstraint at the given index.
Method ConMaxIndex:Int()
ReturnsMaximum index.
DescriptionGet the maximum constraint index used by the TAdvBody.
Informationnote ConMaxIndex returns the maximum index that has been used by the TAdvBody. The actual maximum index may be lower.
Method ConRemove( index:Int )
DescriptionRemoves a constraint from the TAdvBody.
InformationRemoves the constraint at index from the TAdvBody. Remove will also remove any rigs that reference it. It should be noted that index values are not recycled. So removing a constraint will leave a gap in the index range.
Method ConSwapIndex( index1:Int, index2:Int )
DescriptionSwaps the index positions of two constraints.
Method Copy:TAdvBody( active:Int=False )
ReturnsThe copied TAdvBody.
DescriptionCopies the advanced body object.
InformationCreates an exact copy of the TAdvBody. If active is set to false the TAdvBody will not be active immediately and needs to be activated before use. TImages included in the source TAdvBody are not copied, but are instead shared by the original and copy. If a mass from the source TAdvBody was created using an absolute value for it's colGroup, i.e. 0 or above, then the corrisponding copied mass will have the exact same colGroup. If however the original mass was created using -1 as it's colGroup then the copied mass will be given the next unique colGroup. Masses within the same TAdvBody that share the same colGroup will keep those associations after copying.
Method DeActivate()
DescriptionDeactivates the TAdvBody.
InformationStops the TAdvBody from being active in the simulation.
Method Draw()
DescriptionDraws the TAdvBody.
Informationthe Draw method draws all the rigs associated with the TAdvBody.
Method Free()
DescriptionFrees the TAdvBody.
InformationUse free when the TAdvBody is no longer needed to free it from memory.
Method Freeze()
DescriptionFreezes all the bodies masses.
Method GetPosition( x:Float Var, y:Float Var )
DescriptionGets the position of the TAdvBody.
InformationGetPosition assigns the position of the body to the values x,y. The position is in fact the position of the mass with the lowest index, usually 0.
Method GetRotation:Float()
ReturnsThe angle of the constraint with the lowest index.
DescriptionGets the angle of the TAdvBody.
Method GetX:Float()
Returnsthe X coordinate of the TAdvBody.
DescriptionGets the X coordinate of the TAdvBody position.
InformationSee also: GetPosition.
Method GetY:Float()
Returnsthe Y coordinate of the TAdvBody.
DescriptionGets the Y coordinate of the TAdvBody position.
InformationSee also: GetPosition.
Method ImageAdd:Int( url:Object )
ReturnsThe index of the image.
DescriptionAdds an image to the TAdvBody.
InformationAn image must be associated with the TAdvBody before it can be used. The returned index can be used by a rig that is also associated with the body. url can be an existing TImage or the file name of an image.
Method ImageCleanIndex()
DescriptionCondenses the indices of the images.
InformationImageCleanIndex removes gaps in the index list. It should be noted that images index values will be changed by this method.
Method ImageExists:Int( index:Int )
ReturnsTrue if image exists, false if otherwise.
DescriptionSees if image exists.
InformationNot all indices within the index range are used by a TAdvBody. Use ImageExists to see if index is currently in use.
Method ImageGet:TImage( index:Int )
ReturnsTImage at index.
DescriptionGets the image at index.
InformationUse ImageGet to retrieve the actual TImage of the image at index. This can then be used to perform image manipulation beyond the scope of PhysLite.
Method ImageMaxIndex:Int()
ReturnsMaximum index.
DescriptionGet the maximum image index used by the TAdvBody.
InformationNote ImageMaxIndex returns the maximum index that has been used by the TAdvBody. The actual maximum index may be lower.
Method ImageRemove( index:Int )
DescriptionRemoves an image from the TAdvBody.
InformationRemoves the image at index from the TAdvBody. Remove will also remove any rigs that reference it. It should be noted that index values are not recycled. So removing an image will leave a gap in the index range.
Method ImageReplace:Int( index:Int, url:Object )
ReturnsTrue if replace was successful.
DescriptionReplaces one image with another.
InformationReplaces the image at index with another image. This function is mainly useful when creating editors.
Method ImageSwapIndex( index1:Int, index2:Int )
DescriptionSwaps the index positions of two rigs.
Method MassAdd:Int( x:Float, y:Float, mass:Float, radius:Float, friction:Float, colGroup:Int=-1 )
ReturnsThe index of the created mass.
DescriptionCreates and adds a mass to the TAdvBody.
InformationCreates a mass associated with the TAdvBody and returns it's index. See TMass.Create for more information.
Method MassCleanIndex()
DescriptionCondenses the indices of the masses.
InformationMassCleanIndex removes gaps in the index list. It should be noted that masses index values will be changed by this method.
Method MassExists:Int( index:Int )
ReturnsTrue if mass exists, false if otherwise.
DescriptionSees if mass exists.
InformationNot all indices within the index range are used by A TAdvBody. Use MassExists to see if index is currently in use.
Method MassGet:TMass( index:Int )
ReturnsThe TMass at index.
DescriptionGets a TMass component.
InformationMassGet returns the TMass at the given index.
Method MassMaxIndex:Int()
ReturnsMaximum index.
DescriptionGet the maximum mass index used by the TAdvBody.
Informationnote MassMaxIndex returns the maximum index that has been used by the TAdvBody. The actual maximum index may be lower.
Method MassRemove( index:Int )
DescriptionRemoves a mass from the TAdvBody.
InformationRemoves the mass at index from the TAdvBody. Remove will also remove any constraint and rigs that reference it. It should be noted that index values are not recycled. So removing a mass will leave a gap in the index range.
Method MassSwapIndex( index1:Int, index2:Int )
DescriptionSwaps the index positions of two masses.
Method Move( x:Float, y:Float )
DescriptionMoves the TAdvBody.
InformationThe Move method moves all the masses associated with the TAdvBody.
Method Position( x:Float, y:Float)
DescriptionPosition the TAdvBody.
InformationThe Position method positions the TAdvBody at position x,y. The bodies handle is the mass with the lowest index value, usually 0.
Method RigAdd:Int( iIndex:Int, mIndex:Int, cIndex:Int=-1, angle:Float=0 )
ReturnsThe index of the created rig.
DescriptionCreates and adds a rig to the TAdvBody.
InformationCreates a rig associated with the TAdvBody and returns it's index. iIndex is the index of the image to use. mIndex is the index of the mass that will act as the rigs handle. cIndex is the index of the constraint the rig uses to determine it's orientation. angle is the rotational offset offset of the rig. See Create for more infomation.
Method RigCleanIndex()
DescriptionCondenses the indices of the rigs.
InformationRigCleanIndex removes gaps in the index list. It should be noted that rigs index values will be changed by this method.
Method RigExists:Int( index:Int )
ReturnsTrue if rig exists, false if otherwise.
DescriptionSees if rig exists.
InformationNot all indices within the index range are used by A TAdvBody. Use RigExists to see if index is currently in use.
Method RigGet:TRig( index:Int )
ReturnsThe TRig at index.
DescriptionGets a TRig component.
InformationRigGet returns the TRig at the given index.
Method RigMaxIndex:Int()
ReturnsMaximum index.
DescriptionGet the maximum rig index used by the TAdvBody.
InformationNote RigMaxIndex returns the maximum index that has been used by the TAdvBody. The actual maximum index may be lower.
Method RigRemove( index:Int )
DescriptionRemoves a rig from the TAdvBody.
InformationRemoves the rig at index from the TAdvBody. It should be noted that index values are not recycled. So removing a rig will leave a gap in the index range.
Method RigSwapIndex( index1:Int, index2:Int )
DescriptionSwaps the index positions of two rigs.
Method Rotate( angle:Float )
DescriptionRotates TAdvBody.
InformationThe Rotate method rotates the TAdvBoby to an absolute angle. Rotate also set the TAdvBody velocity to 0. Think of Rotate as using MassPosition on all the masses to rotate them to a set angle.
Method Save( url:Object, backup:Int=True, packImages:Int=True )
DescriptionSaves the advanced body object.
InformationSaves a TAdvBody to the location specified by url. If no extension is included in url then the extension ".plb" will be added.

By default Save packs the any images used by the body into the .plb file. If packImages is set to false then images are saved alongside the save file with the suffix "_img00.png", where 00 is the index of the image within the TAdvBody.

Method Spin( angle:Float )
DescriptionSpins the TAdvBody.
InformationThe Spin method spins the TAdvBody by angle degrees. This will also add velocity to the body meaning it will continue to spin. Think of Spin as performing MassMove on all the masses to spin the body angle degrees.
Method Thaw()
DescriptionThaws all the bodies masses.
Method Translate( x:Float, y:Float )
DescriptionTranslates the TAdvBody.
InformationThe Translate method translates all the masses associated with the TAdvBody.
Method Turn( angle:Float )
DescriptionTurns the TAdvBody.
InformationThe Turn method turns the TAdvBody angle degrees. Turn leave the bodies current velocity unaffected. Think of Turn as performing MassTranslate on all the masses to turn the body angle degrees.
Function ApplyToAll( ApplyFunc( advBody:TAdvBody ) )
DescriptionMaps one function to all TAdvBodies.
InformationApplyFunc is the function that will be run for every active TAdvBody in the simulation.
Function CountAll:Int()
ReturnsThe number of TAdvBodies.
DescriptionCounts all TAdvBodies.
InformationCountAll will include TAdvBodies that are not active.
Function Load:TAdvBody( url:Object, active:Int=False )
ReturnsLoaded TAdvBody.
DescriptionLoads a previously saved advanced body object.
InformationThe Load function loads a TAdvBody that has previously been saved using the Save method. The active parameter determines if the TAdvBody will be Activated immediately after loading. The loaded TAdvBody will be identical to the original, however collision groups need a little further explination. If a mass was created using an absolute value for it's colGroup, i.e. 0 or above, then the corrisponding loaded mass will have the exact same colGroup. If however the original mass was created using -1 as it's colGroup the loaded mass will be given the next unique colGroup. Masses within the same TAdvBody that share the same colGroup will keep those associations after loading.

Type TBody
DescriptionTBody object.
Methods Summary
Clear Deprecated: Use Free instead.
Free Frees all constraints from TBody.
GetConstraints Gets bodies constraints.
GetName Gets bodies name.
SetName Sets bodies name.
Method Clear()
DescriptionDeprecated: Use Free instead.
InformationDeprecated: Use Free instead.
Method Free()
DescriptionFrees all constraints from TBody.
InformationFrees all constraints that are currently assigned to the TBody. Use Free when a body is no longer needed.
Method GetConstraints:TList()
Returnslist of constraints.
DescriptionGets bodies constraints.
InformationCreates a list containing all the Constraints associsted with the TBody object.
Method GetName:String()
DescriptionGets bodies name.
Method SetName( n:String )
DescriptionSets bodies name.

Type TColEvent
DescriptionCollision Event object.
Globals Summary
Hook
Methods Summary
GetForce Get the force of the collision event.
GetID Gets the ID of the collision object.
GetMass1 Gets the first TMass associated with the collision event.
GetMass2 Gets the second TMass associated with the collision event.
GetX Get the x coordinate of the collision event.
GetY Get the y coordinate of the collision event.
GetZone Gets the TZone associated with the collision event.
Functions Summary
Create Creates a collision event object.
Emit Emits a collision event.
Flush Clears the collision event queue.
GetCurrent Gets the last polled collision event.
Peek Gets the next collision event from the queue.
Poll Removes the next collision event from the queue.
Post Posts a collision event to the collision events queue.
Seek Gets the collision event associated with two objects.
SetMode Sets how collision events are added to the event queue.
Global Hook:Int
DescriptionThe collision event hook ID.
InformationThe hook event which can be used by AddHook to add a hook function.
Method GetForce:Float()
ReturnsThe force of the collision.
DescriptionGet the force of the collision event.
InformationBecause PhysLite uses a verlet integration collisions aren't resolved immedaitely. They are in fact relaxed over several iterations, and even sometimes several updates. As a result the force is shared through these relaxations. Using SetMode to set the mode to MODE_UPDATE will total all the forces over several iterations, but it should be noted that it will not include force shared across several updates will not be included. The force returned is not just the result of kinetic(velocity) force, but also the result of weight. A stationary TMass, which is under many other TMass objects, could easily create a collision with more force than one created solely by movement.
Method GetID:Int()
ReturnsThe ID of the collision object.
DescriptionGets the ID of the collision object.
InformationThe return value can be checked against the constants, MASS_MASS, MASS_ZONE, MASS_BOUNDS and MASS_CUSTOM. A value of MASS_MASS means the collision event is between two TMass objects. A value of MASS_MASS means the event is between a TMass and a TZone. MASS_BOUNDS means the events is between a TMass and the simulation bounds. If the collision event is does not fit any of these values then GetID return MASS_CUSTOM.
Method GetMass1:TMass()
ReturnsThe first TMass associated with the collision event.
DescriptionGets the first TMass associated with the collision event.
InformationCollision events must always have at least one TMass associated with them. Use GetMass1 to retrieve that TMass.
Method GetMass2:TMass()
ReturnsThe second TMass associated with the collision event.
DescriptionGets the second TMass associated with the collision event.
InformationIf there isn't a second TMass associated with the collision event then GetMass2 returns Null.
Method GetX:Float()
ReturnsThe x coordinate of the collision.
DescriptionGet the x coordinate of the collision event.
Method GetY:Float()
ReturnsThe y coordinate of the collision.
DescriptionGet the y coordinate of the collision event.
Method GetZone:TZone()
ReturnsThe TZone associated with the collision event.
DescriptionGets the TZone associated with the collision event.
InformationIf no TZone is associated with the collision event then GetZone returns Null.
Function Create:TColEvent( obj1:TMass, obj2:Object, x:Float, y:Float, force:Float )
ReturnsThe created collision event.
DescriptionCreates a collision event object.
InformationCraetes a collision event that can then be emitted or posted.
Function Emit( colEvent:TColEvent )
DescriptionEmits a collision event.
InformationWhen a collision event is emitted all hooked functions are run and then the event is posted to the event queue. If the hook functions return Null then the collision event will not be posted to the event queue. Emitting is usually handled automatically by Update but Emit can be used to fake a collision event.
Function Flush()
DescriptionClears the collision event queue.
InformationAfter a call to Flush the functions Poll, Peek, Seek and GetCurrent will all return Null. Update will automatically Flush the collision event queue ready to make a new one.
Function GetCurrent:TColEvent()
Returnsthe last polled collision event.
DescriptionGets the last polled collision event.
InformationIf no collision event has been polled yet or an empty queue has been polled then GetCurrent returns Null.
Function Peek:TColEvent()
ReturnsThe next collision event.
DescriptionGets the next collision event from the queue.
InformationSimilar to Poll, however Peek does not remove the event from the queue.
Function Poll:TColEvent()
ReturnsThe next collision event in the queue.
DescriptionRemoves the next collision event from the queue.
InformationPoll sequentially removes collision events from the queue, and sets it to the current event. If there are no more events in the queue then Poll returns Null.
Function Post( colEvent:TColEvent, update:Int=MODE_UPDATE )
DescriptionPosts a collision event to the collision events queue.
InformationSimilar to Emit, Post will add a collision event to the collision event queue. However posted collision events will not run any hooked functions. The update parameter is used to tell PhysLite to either update or replace previous collisions between the same objects. See SetMode for more information on modes.
Function Seek:TColEvent( colObj1:Object, colObj2:Object=Null )
ReturnsThe collision event found.
DescriptionGets the collision event associated with two objects.
InformationSeek finds the collision event associated with two objects. One of the parameters must be a TMass the other can be either a TMass or TZone. Alternatively leaving the second parameter as Null will check for a collision with the simulation bounds. The returned collision event will not be removed from the queue, and collisions that have already been polled can still be found using Seek. If no collision occured between the two objects then Seek returns Null.
Function SetMode( value:Int )
DescriptionSets how collision events are added to the event queue.
InformationSets the way collision events are added to the event queue. If there is more than one iteration then it is possible for two objects to collide more than once during the same update. SetMode tells PhysLite how to report multiple collision between the same objects. Value can be one of the following values, MODE_DISCARD, MODE_UPDATE or MODE_REPLACE. MODE_DISCARD means no events will be added to the event queue, although hooked functions will still be called. Setting MODE_DISCARD will give a speed increase. It is also useful for making your own custom event queue using hook functions. MODE_UPDATE will total the force of multiple collisions between the same objects. This is the default mode. MODE_REPLACE will discard previous collision events between the same two objects and only report the last.

Type TConstraint
DescriptionConstraint object.
Methods Summary
Assign Assigns constraint to a TBody.
Draw Draws the TConstraint.
Free Frees constraint from TBody.
GetAdvBody Gets the TAdvBody that the constraint is associated with.
GetAngle Gets the current angle of the constraint.
GetIndex Gets the index of the constraint.
GetLength Gets the constraints actual length.
GetMass1 Gets the first mass associated with the constraint.
GetMass2 Gets the second mass associated with the constraint.
GetName Gets constraints name.
GetRestLength Gets the constraints rest length.
GetStiffness Gets current stiffness.
GetStress Gets the current stress of the constraint.
IsActive Checks if constraint is currently active in the simulation.
SetName Sets constraints name.
SetRestLength Sets the constraints rest length.
SetStiffness Sets constraints stiffness.
Functions Summary
ApplyToActive Maps one function to all active TConstraints.
CountActive Counts the number of active TConstraints.
Create Creates a new TConstraint object.
Method Assign( b:TBody )
DescriptionAssigns constraint to a TBody.
InformationA constraint must be assigned to a TBody before it becomes active.
Method Draw()
DescriptionDraws the TConstraint.
Method Free( b:TBody )
DescriptionFrees constraint from TBody.
InformationNote: A constraint can be assigned to more than one TBody. Freeing a constraint from one TBody will not free it from any others it is assigned to.
Method GetAdvBody:TAdvBody()
ReturnsThe TAdvBody of the constraint.
DescriptionGets the TAdvBody that the constraint is associated with.
InformationGetAdvBody returns null if the constraint isn't associated with an TAdvBody.
Method GetAngle:Float()
ReturnsCurrent angle.
DescriptionGets the current angle of the constraint.
InformationThis is the angle from mass1 to mass2.
Method GetIndex:Int()
ReturnsThe index of the constraint.
DescriptionGets the index of the constraint.
InformationGetIndex returns -1 if the constraint isn't associated with an TAdvBody.
Method GetLength:Float()
ReturnsLength.
DescriptionGets the constraints actual length.
InformationGetLength is used to find the current length of the constraint.
Method GetMass1:TMass()
DescriptionGets the first mass associated with the constraint.
InformationEach constraint has two masses associated with it. GetMass1 returns the first, to get the second use GetMass2.
Method GetMass2:TMass()
DescriptionGets the second mass associated with the constraint.
InformationEach constraint has two masses associated with it. GetMass2 returns the second, to get the first use GetMass1.
Method GetName:String()
ReturnsConstraints name.
DescriptionGets constraints name.
Method GetRestLength:Float()
ReturnsRest length.
DescriptionGets the constraints rest length.
InformationNote: The current length of the constraint may differ from it's intended rest length. To get the constraints actual length use GetLength.
Method GetStiffness:Float()
ReturnsCurrent stiffness.
DescriptionGets current stiffness.
Method GetStress:Float()
ReturnsStress ratio.
DescriptionGets the current stress of the constraint.
InformationA returned value of 1.0 means the constraint is under no stress and is at rest. A value>1.0 means the constraint is being stretched. A value<1.0 means the constraint is being compressed. GetStress will never return a negative result.
Method IsActive:Int()
ReturnsTrue if constraint is active.
DescriptionChecks if constraint is currently active in the simulation.
Method SetName( n:String )
DescriptionSets constraints name.
Method SetRestLength( length:Float=-1 )
DescriptionSets the constraints rest length.
InformationThe constraints rest length is the length the constraint attempts to maintain.
Method SetStiffness( stiff:Float )
DescriptionSets constraints stiffness.
InformationStiffnes should be within the range 0.0 to 1.0.
Function ApplyToActive( ApplyFunc( con:TConstraint ) )
DescriptionMaps one function to all active TConstraints.
InformationApplyFunc is the function that will be run for every active TConstraint in the simulation.
Function CountActive:Int()
ReturnsThe number of active TConstraints.
DescriptionCounts the number of active TConstraints.
InformationCountActive only counts TConstraints that are associated with a TBody.
Function Create:TConstraint( m1:TMass, m2:TMass, restLength:Float=-1, stiffness:Float=1.0 )
ReturnsCreated TConstraint.
DescriptionCreates a new TConstraint object.
InformationA constraint is an invisible conection between two TMasses. restLength is the length of the constraint. Setting restLength to -1 results in restLength being calculated based on the current distance between the two masses.

Type TMass
DescriptionMass object.
Methods Summary
AddVelocity Alters masses velocity.
Copy Creates a copy of the mass.
Draw Draws the TMass.
Freeze Freezes TMass.
GetAdvBody Gets the TAdvBody that the mass is associated with.
GetColGroup Returns masses collision group.
GetFriction Gets the current friction coefficient of the TMass object.
GetIndex Gets the index of the mass.
GetMass Gets the current mass of the TMass object.
GetName Gets masses name.
GetPosition Sets x and y to masses position.
GetPositionX Gets masses current X coordinate.
GetPositionY Gets masses current Y coordinate.
GetRadius Gets the collision radius of the mass.
GetVelocity Gets the magnitude of the TMass objects velocity vector.
GetVelocityX Gets TMass objects X velocity.
GetVelocityY Gets TMass objects Y velocity.
GetVX Gets TMass objects X velocity.
GetVY Gets TMass objects Y velocity.
GetX Gets masses current X coordinate.
GetY Gets masses current Y coordinate.
IsActive Checks if mass is currently active in the simulation.
Move Moves TMass relative to it's current position.
Position Sets masses absolute position.
SetColGroup Sets masses collision group.
SetFriction Sets masses friction.
SetMass Sets the current mass of the TMass object.
SetName Sets masses name.
SetRadius Sets the collision radius of the mass.
SetVelocity Sets masses velocity.
Thaw Thaws TMass.
Translate Translates TMass.
Functions Summary
ApplyToActive Maps one function to all active TMass objects.
CountActive Counts the number of active TMass objects.
Create Creates a mass object.
Method AddVelocity( x:Float, y:Float )
DescriptionAlters masses velocity.
InformationAddVelocity differs from SetVelocity in that the masses current velocity is added to instead of replaced by X and Y.
Method Copy:TMass()
ReturnsTMass Copy.
DescriptionCreates a copy of the mass.
Method Draw()
DescriptionDraws the TMass.
Method Freeze()
DescriptionFreezes TMass.
InformationFreezing a TMass makes it immovable during the simulation. The following methods do not affect a frozen TMass, Move, Translate, SetVelocity and AddVelocity.
Method GetAdvBody:TAdvBody()
ReturnsThe TAdvBody of the mass.
DescriptionGets the TAdvBody that the mass is associated with.
InformationGetAdvBody returns null if the mass isn't associated with an TAdvBody.
Method GetColGroup:Int()
ReturnsCollision group.
DescriptionReturns masses collision group.
Method GetFriction:Float()
ReturnsCurrent friction coefficient.
DescriptionGets the current friction coefficient of the TMass object.
Method GetIndex:Int()
ReturnsThe index of the mass.
DescriptionGets the index of the mass.
InformationGetIndex returns -1 if the mass isn't associated with an TAdvBody.
Method GetMass:Float()
ReturnsCurrent mass.
DescriptionGets the current mass of the TMass object.
Method GetName:String()
DescriptionGets masses name.
Method GetPosition( x:Float Var, y:Float Var )
DescriptionSets x and y to masses position.
Method GetPositionX:Float()
Returnsmasses X coordinate.
DescriptionGets masses current X coordinate.
Method GetPositionY:Float()
ReturnsMasses Y coordinate.
DescriptionGets masses current Y coordinate.
Method GetRadius:Float()
DescriptionGets the collision radius of the mass.
Method GetVelocity:Float()
DescriptionGets the magnitude of the TMass objects velocity vector.
Method GetVelocityX:Float()
ReturnsMasses x velocity.
DescriptionGets TMass objects X velocity.
Method GetVelocityY:Float()
ReturnsMasses y velocity.
DescriptionGets TMass objects Y velocity.
Method GetVX:Float()
ReturnsMasses x velocity.
DescriptionGets TMass objects X velocity.
InformationShort hand version of GetVelocityX.
Method GetVY:Float()
ReturnsMasses y velocity.
DescriptionGets TMass objects Y velocity.
InformationShort hand version of GetVelocityY.
Method GetX:Float()
Returnsmasses X coordinate.
DescriptionGets masses current X coordinate.
InformationShort hand version of GetPositionX.
Method GetY:Float()
ReturnsMasses Y coordinate.
DescriptionGets masses current Y coordinate.
InformationShort hand version of GetPositionY.
Method IsActive:Int()
ReturnsTrue if mass is active.
DescriptionChecks if mass is currently active in the simulation.
Method Move( x:Float, y:Float )
DescriptionMoves TMass relative to it's current position.
InformationWhen using Move it's important to note that the masses velocity will also be altered by the same amount. To move a masses without affecting it's velocity then use Translate. A frozen, see Freeze, TMass cannot be moved.
Method Position( x:Float, y:Float )
DescriptionSets masses absolute position.
InformationPositioning a mass also resets it's velocity. Position may be used on a frozen mass.
Method SetColGroup( value:Int=-1 )
DescriptionSets masses collision group.
InformationA value of -1 will set the masses collision group to the next unique value. If two collidable objects have the same collision group then they will not collide with each other. If colGroup is set to 0 then the mass will not collide with any other object.
Method SetFriction( f:Float )
DescriptionSets masses friction.
InformationFriction should always be positive.
Method SetMass( m:Float )
DescriptionSets the current mass of the TMass object.
InformationMass should always be positive.
Method SetName( n:String )
DescriptionSets masses name.
Method SetRadius( r:Float )
DescriptionSets the collision radius of the mass.
Method SetVelocity( x:Float, y:Float )
DescriptionSets masses velocity.
InformationSets the masses velocity.
Method Thaw()
DescriptionThaws TMass.
InformationThaw unfreezes the TMass.
Method Translate( x:Float, y:Float )
DescriptionTranslates TMass.
InformationTranslate works the same as Move except the masses velocity remains the same. Translate can be used on a frozen mass.
Function ApplyToActive( ApplyFunc( mass:TMass ) )
DescriptionMaps one function to all active TMass objects.
InformationApplyFunc is the function that will be run for every active TMass in the simulation.
Function CountActive:Int()
ReturnsThe number of active TMass objects.
DescriptionCounts the number of active TMass objects.
InformationCountActive only counts TMass objects that are associated with an active TConstraint.
Function Create:TMass( x:Float, y:Float, mass:Float, radius:Float, friction:Float, colGroup:Int=-1 )
ReturnsCreated TMass.
DescriptionCreates a mass object.
InformationThe Create function creates a TMass to be used by the simulation. The TMass does not become active until it is assigned to an active TConstraint. The parameter colGroup is the masses collision group. A value of -1 will set the masses collision group to the next unique value. If two collidable objects have the same collision group then they will not collide with each other. If colGroup is set to 0 then the mass will not collide with any other object.

Type TPhysics
DescriptionPhysics simulation object.
Functions Summary
Create Creates a new physics simulation.
DrawImage Draws an image.
DrawLine Draws a line.
DrawOval Draws an oval.
DrawPoly Draws a polygon.
DrawRect Draws a rectangle.
Free Ends the physics simulation.
GetBounds Get the upper and lower bounds of the simulation.
MouseX Gets the mouse X coordinate.
MouseY Gets the mouse Y coordinate.
ScreenX Gets the screen x coordinate.
ScreenY Gets the screen y coordinate.
SetBounds Set the upper and lower bounds of the simulation.
SetDrawCoords Set the area of simulation to draw.
SetDrawRotation Sets the angle at which to draw the simulation.
SetDrawZoom Set the zoom of the draw commands.
SetFriction Set the friction of the simulations bounds.
SetGravity Sets the simulation gravity.
SetGridSize Set the size of the shifted grid.
SetIterations The number of iterations used by the simulation.
SimX Gets the simulation X coordinate of a screen x,y location.
SimY Gets the simulation Y coordinate of a screen x,y location.
Update Update simulation.
UpdateTransform Updates the transform/rotation matrix.
UseShiftedGrid Activate or de-activate the use of the shifted grid for TMass occlusion.
Function Create:TPhysics( width:Float, height:Float, gravY:Float, gravX:Float=0.0, i:Int=1 )
ReturnsA TPhysics object.
DescriptionCreates a new physics simulation.
InformationNote: that the gravity gravY parameter is before the gravX parameter.
Function DrawImage( image:TImage, x:Float, y:Float, frame:Int=0 )
DescriptionDraws an image.
InformationDraws an image at simulation coordinates x,y and with the correct rotation.
Function DrawLine( x:Float, y:Float, x2:Float, y2:Float )
DescriptionDraws a line.
InformationDraws a line at the correct simulation coordinates.
Function DrawOval( x:Float, y:Float, width:Float, height:Float )
DescriptionDraws an oval.
InformationDraws an oval at simulation coordinates x,y and with the correct rotation.
Function DrawPoly( xy:Float[], x:Float=0.0, y:Float=0.0 )
DescriptionDraws a polygon.
InformationDraws a polygon at simulation coordinates x,y and with the correct rotation.
Function DrawRect( x:Float, y:Float, width:Float, height:Float )
DescriptionDraws a rectangle.
InformationDraws a rectangle at simulation coordinates x,y and with the correct rotation.
Function Free()
DescriptionEnds the physics simulation.
Function GetBounds( lowerX:Float Var, lowerY:Float Var, upperX:Float Var, upperY:Float Var )
DescriptionGet the upper and lower bounds of the simulation.
Function MouseX:Float()
ReturnsMouse X coordinate.
DescriptionGets the mouse X coordinate.
InformationMouseX returns the simulation X coordinate of the mouse cursor.
Function MouseY:Float()
ReturnsMouse Y coordinate.
DescriptionGets the mouse Y coordinate.
InformationMouseY returns the simulation Y coordinate of the mouse cursor.
Function ScreenX:Float( valueX:Float, valueY:Float )
ReturnsThe screen x coordinate of simulation x,y coordinate.
DescriptionGets the screen x coordinate.
Function ScreenY:Float( valueX:Float, valueY:Float )
ReturnsThe screen y coordinate of simulation x,y coordinate.
DescriptionGets the screen y coordinate.
Function SetBounds( lowerX:Float, lowerY:Float, upperX:Float, upperY:Float )
DescriptionSet the upper and lower bounds of the simulation.
Function SetDrawCoords( centerX:Float, centerY:Float )
DescriptionSet the area of simulation to draw.
InformationcenterX and centerY are the simulation coordinates to be mapped to the center of the screen.
Function SetDrawRotation( angle:Float=0 )
DescriptionSets the angle at which to draw the simulation.
InformationSetDrawRotation rotates all drawing commands in PhysLite. Use the drawing commands within PhysLite to draw in the corrrect simulation location. SetDrawRotation does not affect the ordinary Max2D drawing commands.
Function SetDrawZoom( zoom:Float=1.0 )
DescriptionSet the zoom of the draw commands.
Function SetFriction( frict:Float )
DescriptionSet the friction of the simulations bounds.
Function SetGravity( x:Float, y:Float )
DescriptionSets the simulation gravity.
InformationGravity can go in any direction dictated by the vector x,@y.
Function SetGridSize( value:Int=8 )
DescriptionSet the size of the shifted grid.
InformationThe shifted grid size can be in the range of 8-64. When using the shifted grid, setting the size of the grid too high can make the simulation unstable. To make sure that the grid is not set too high use the following equation. (maxBound-minBound)/diam. Where minBound and maxBound are the dimensions of the smallest side of the simulation area, and diam is the diameter(radius*2) of the largest TMass in the simulation. Even this equation will create a shifted grid size right on the limit so it is probably best to use this equation as an absolute maximum.
Function SetIterations( value:Int )
DescriptionThe number of iterations used by the simulation.
InformationThe higher the value the more accurate and stiff the simulation. The lower the value then the faster and softer the simulation.
Function SimX:Float( x:Float, y:Float )
ReturnsSimulation X coordinate.
DescriptionGets the simulation X coordinate of a screen x,y location.
Information.
Function SimY:Float( x:Float, y:Float )
ReturnsSimulation Y coordinate.
DescriptionGets the simulation Y coordinate of a screen x,y location.
Information.
Function Update()
DescriptionUpdate simulation.
InformationProcess the physics iterations and responses. Update will Flush the event collision queue.
Function UpdateTransform()
DescriptionUpdates the transform/rotation matrix.
InformationUnder normal circamstances UpdateTransform will not be needed as the transform/rotation matrix is update by any commands that would change it. However, UpdateTransform is required when the display dimensions are changed, and it becomes indespensable when using a MaxGUI canvas.
Function UseShiftedGrid( value:Int )
DescriptionActivate or de-activate the use of the shifted grid for TMass occlusion.
InformationSet to true to use the shifted grid to occlude TMass objects. The shifted grid occlusion is not used by default. The shifted grid gives the best performance when used with extremely large simulations, and will actually be slower on very small simulations. For more information see SetGridSize.

Type TRig
DescriptionTRig object.
Methods Summary
Draw Draws the TRig.
GetAdvBody Gets the TAdvBody that the rig is associated with.
GetAlpha Gets the rigs alpha value.
GetAngle Gets the rigs angular offset.
GetBlend Gets the rigs current blend mode.
GetColor Gets the rigs color.
GetConstraint Returns the Tconstraint associated with the TRig.
GetImage Gets the image currently associated with the TRig.
GetIndex Gets the index of the rig.
GetMass Gets the mass associated with the TRig.
GetName Gets rigs name.
GetScale Gets the rigs scale.
SetAlpha Sets the alpha value of the rig.
SetAngle Sets the TRigs angle offset.
SetBlend Sets the rigs blend mode.
SetColor Sets the tint of the rig.
SetConstraint Sets the TRigs constraint.
SetImage Sets the TRigs image.
SetMass Sets the TRigs mass.
SetName Sets rigs name.
SetScale Sets the scale at which the rig is drawn.
Functions Summary
Create Creates a new TRig.
Method Draw()
DescriptionDraws the TRig.
InformationDraws the TRig to the screen. The position and orientation are based on the mass and constraint associated with the TRig. The drawing of TRigs is scaled by using PhysicsSetDrawScale.
Method GetAdvBody:TAdvBody()
ReturnsThe TAdvBody of the rig.
DescriptionGets the TAdvBody that the rig is associated with.
InformationGetAdvBody returns null if the rig isn't associated with an TAdvBody.
Method GetAlpha:Float()
ReturnsThe alpha value of the rig.
DescriptionGets the rigs alpha value.
Method GetAngle:Float()
ReturnsThe difference between the rigs constraints angle and the angle at which the rigs image will be drawn.
DescriptionGets the rigs angular offset.
InformationIf the rig has no constraint associated with it GetAngle returns the angle at which the rigs image is drawn.
Method GetBlend:Int()
ReturnsThe rigs current blend mode.
DescriptionGets the rigs current blend mode.
InformationThe returned value will be one of MASKBLEND, SOLIDBLEND, ALPHABLEND, LIGHTBLEND or SHADEBLEND.
Method GetColor( r:Int Var, g:Int Var, b:Int Var )
DescriptionGets the rigs color.
InformationSets r, g and b to the red, green and blue values respectively of the rig.
Method GetConstraint:TConstraint()
ReturnsThe TConstraint of the rig.
DescriptionReturns the Tconstraint associated with the TRig.
InformationGetConstraint gives you access to the TConstraint of the rig. If the rig has no TConstraint associated with it then GetConstraint returns null.
Method GetImage:TImage()
ReturnsThe rigs current image.
DescriptionGets the image currently associated with the TRig.
InformationGetImage gives you access to the rigs image.
Method GetIndex:Int()
ReturnsThe index of the rig.
DescriptionGets the index of the rig.
InformationGetIndex returns -1 if the rig isn't associated with a TAdvBody.
Method GetMass:TMass()
ReturnsThe TMass object that acts as the rigs handle.
DescriptionGets the mass associated with the TRig.
InformationGetMass gives you access to the rigs Tmass object.
Method GetName:String()
DescriptionGets rigs name.
Method GetScale( x:Float Var, y:Float Var )
DescriptionGets the rigs scale.
InformationSets x and y to the rigs current x and y scale.
Method SetAlpha( value:Float )
DescriptionSets the alpha value of the rig.
InformationThe rigs alpha will only have an effect if the rigs blend mode is ALPHABLEND or LIGHTBLEND.
Method SetAngle( a:Float )
DescriptionSets the TRigs angle offset.
InformationThis sets the angular offset from the constraint at which the rig will be drawn.
Method SetBlend( value:Int )
DescriptionSets the rigs blend mode.
InformationValue should be one of MASKBLEND, SOLIDBLEND, ALPHABLEND, LIGHTBLEND or SHADEBLEND.
Method SetColor( r:Int, g:Int, b:Int )
DescriptionSets the tint of the rig.
InformationSetColor sets the color tint that the rig will be drawn with.
Method SetConstraint( c:TConstraint=Null )
DescriptionSets the TRigs constraint.
InformationThe constraints orientation determines the rigs rotation.
Method SetImage( img:TImage )
DescriptionSets the TRigs image.
Method SetMass( m:TMass )
DescriptionSets the TRigs mass.
Method SetName( n:String )
DescriptionSets rigs name.
Method SetScale( valueX:Float, valueY:Float )
DescriptionSets the scale at which the rig is drawn.
InformationSets the x and y scale of the rigs image.
Function Create:TRig( image:TImage, mass:TMass, con:TConstraint=Null, angle:Float=0 )
ReturnsCreated TRig.
DescriptionCreates a new TRig.
InformationCreates a rig attached to mass and orientated relative to con. angle is how much the images orientation is offset. If con is Null then the image is orientated only by angle.

Type TZone
DescriptionCollision zone object.
Methods Summary
Activate Makes the collision zone active in the simulation.
CalcQuadTree Recalculates zones QuadTree.
Copy Cretaes a copy of the zone.
DeActivate De-activates collision zone.
Draw Draws the TZone.
DrawQuadTree Draws the images quadtree.
Free Removes TZone from the simulation.
GetAlpha Gets the zones current alpha.
GetArea Gets the zones area.
GetBlend Gets the zones current blend mode.
GetColGroup Gets the collision group of the TZone.
GetColor Gets the zones current color setting.
GetFriction Gets the zones friction value.
GetName Gets the zones name.
GetPositionX Gets the current X position of the TZone.
GetPositionY Gets the current Y position of the TZone.
GetQTLevel Gets the zones current quadtree level.
GetRotation Gets the current rotation of the zone.
GetScale Gets the zones scale.
GetStyle Gets the zones current style.
GetX Gets the current X position of the TZone.
GetY Gets the current Y position of the TZone.
ImageGet Gets the zones current image.
ImageGetScale Gets the zones current image scale.
ImageSetScale Sets the zones image scale.
Move Moves the collision zone relative to it's current position.
OverrideCollision Sets the function to be used for collisions.
Position Positions the collision zone within the simulation.
Rotate Rotates collision zone.
Save Saves a collision zone.
SetAlpha Sets the zones alpha.
SetBlend Sets the zones blend mode.
SetColGroup Sets the zones collision group.
SetColor Sets the zones color.
SetFriction Sets collision zones friction.
SetName Sets the zones name.
SetScale Sets the zones scale.
SetStyle Sets the zones style.
Turn Turns collision zone.
VertAddFirst Adds a vertex to the zones area.
VertAddLast Adds a vertex to the zones area.
VertCount Counts the number of vertex in the zones area.
VertGetPosition Gets a vertex's position.
VertGetX Gets the vertex's x coordinate.
VertGetY Gets the vertex's y coordinate.
VertInsert Adds a vertex to a zones area.
VertPosition Positions a vertex.
VertRemove Removes a vertex from a zones area.
VertRemoveFirst Removes a vertex from the zones area.
VertRemoveLast Removes a vertex from the zones area.
Functions Summary
ApplyToActive Maps one function to all active TZones.
CountActive Counts the number of active TZones.
Create Creates a new collision zone.
Load Loads a saved collision zone.
Method Activate()
DescriptionMakes the collision zone active in the simulation.
InformationActivates a de-active collision zone.
Method CalcQuadTree( level:Int=1 )
DescriptionRecalculates zones QuadTree.
Method Copy:TZone()
ReturnsThe zones copy.
DescriptionCretaes a copy of the zone.
InformationThe new zone will be identical to the original. The new zone will initially share the originals image and quadtree. However any subsiquent changes to the originals quadtree or image will not affect the copy.
Method DeActivate()
DescriptionDe-activates collision zone.
InformationA de-active collision zone does not create collision events or responses.
Method Draw()
DescriptionDraws the TZone.
InformationDraws the TZone to the display. If an image has not been set for the TZone then a polygon is drawn. Draw is affected by PhysicsSetDrawScale.
Method DrawQuadTree( filled:Int=True )
DescriptionDraws the images quadtree.
InformationDrawQuadTree is too slow for serious realtime use, but can be an invaluable debugging tool.
Method Free()
DescriptionRemoves TZone from the simulation.
Method GetAlpha:Float()
ReturnsThe zones alpha.
DescriptionGets the zones current alpha.
Method GetArea:Float[]()
ReturnsCollision zone.
DescriptionGets the zones area.
InformationGetArea returns an array of x:Float, y:Float coordinate pairs. The coordinates are rotated, but are not offset by the zones current position.
Method GetBlend:Int()
ReturnsThe zones blend mode.
DescriptionGets the zones current blend mode.
Method GetColGroup:Int()
ReturnsZones collision group.
DescriptionGets the collision group of the TZone.
Method GetColor( r:Int Var, g:Int Var, b:Int Var )
DescriptionGets the zones current color setting.
InformationSets r, g and b to the zones current red, green and blue value respectively.
Method GetFriction:Float()
ReturnsThe zones friction.
DescriptionGets the zones friction value.
Method GetName:String()
ReturnsThe zones name.
DescriptionGets the zones name.
Method GetPositionX:Float()
DescriptionGets the current X position of the TZone.
Method GetPositionY:Float()
DescriptionGets the current Y position of the TZone.
Method GetQTLevel:Int()
ReturnsThe zones quadtree level.
DescriptionGets the zones current quadtree level.
Method GetRotation:Float()
ReturnsThe zones rotation.
DescriptionGets the current rotation of the zone.
Method GetScale( x:Float Var, y:Float Var )
DescriptionGets the zones scale.
InformationSets x and y to the zones current scale.
Method GetStyle:Int()
ReturnsThe zones current style.
DescriptionGets the zones current style.
InformationGetStyle returns either LINE, LOOP, FILL, or HOLE.
Method GetX:Float()
DescriptionGets the current X position of the TZone.
Method GetY:Float()
DescriptionGets the current Y position of the TZone.
Method ImageGet:TImage()
ReturnsThe zones current image.
DescriptionGets the zones current image.
InformationImageGet returns null if no image is associated with the zone.
Method ImageGetScale( x:Float Var, y:Float Var )
DescriptionGets the zones current image scale.
InformationSets x and y to the zones images current scale.
Method ImageSetScale( x:Float, y:Float )
DescriptionSets the zones image scale.
InformationSets the scale that a zones image will be drawn with.

Note: SetScale also affects the scale that a zones image is drawn with.

Method Move( x:Float, y:Float )
DescriptionMoves the collision zone relative to it's current position.
InformationTZones are intended to be stationary, and it is recomended not to move a TZone if it may collide with active masses. If a dynamic collision area is needed consider using a TBody instead.
Method OverrideCollision( CustomResponse(zone:TZone,mass:TMass,penNormX:Float,penNormY:Float,penMag:Float)=Null )
DescriptionSets the function to be used for collisions.
InformationIf no function is named the default collision function will be used. Recommended for advanced users only.
Method Position( x:Float, y:Float )
DescriptionPositions the collision zone within the simulation.
Method Rotate( value:Float )
DescriptionRotates collision zone.
InformationNot recommended for realtime use.
Method Save( url:Object, backup:Int=True, packImage:Int=True )
DescriptionSaves a collision zone.
InformationSaves a zone to a designated by url. If no file extention is given then ".plz" is appended to the end of url.

If backup is set to true the a backup of any exist file with the same path will be made.

Setting packImage to true will save the zones image in the .plz file. If it is set to false it is saved along side the zones file with the same file name, but prefixed "_img.png".

Save does not save custom collision responses that have been set for the zone using OverrideCollision. These can only be added at runtime.

Method SetAlpha( value:Float )
DescriptionSets the zones alpha.
InformationSetAlpha will only have an effect on zones with the alpha or light blend mode.
Method SetBlend( value:Int )
DescriptionSets the zones blend mode.
InformationValue can be one of MASKBLEND, SOLIDBLEND, ALPHABLEND, LIGHTBLEND or SHADEBLEND.
Method SetColGroup( value:Int=-1 )
DescriptionSets the zones collision group.
InformationFor more info on collision groups see SetColGroup.
Method SetColor( r:Int, g:Int, b:Int )
DescriptionSets the zones color.
InformationIf no image is set for the zone then this will be the zones color. Otherwise SetColor will tint the images color.
Method SetFriction( f:Float )
DescriptionSets collision zones friction.
InformationFriction should always be positive.
Method SetName( n:String )
DescriptionSets the zones name.
Method SetScale( x:Float, y:Float )
DescriptionSets the zones scale.
InformationSetZone scales the collision zone by x and y. SetScale will also affect the zones image scale.
Method SetStyle( value:Int )
DescriptionSets the zones style.
InformationA zones style determines how TMass objects collide with it. Value can be either LINE, LOOP, FILL, or HOLE.

LINEThe zone is a line that isn't joined at both end
LOOPThe zone is a line that is joined at each end to form a loop
FILLThe zone is a solid polygon
HOLEThe HOLE style is the inverse of FILL

Method Turn( value:Float )
DescriptionTurns collision zone.
InformationNot recommended for realtime use.
Method VertAddFirst( x:Float, y:Float )
DescriptionAdds a vertex to the zones area.
InformationAdds a vertex to the beginning of the zones area at position x,y.
Method VertAddLast( x:Float, y:Float )
DescriptionAdds a vertex to the zones area.
InformationAdds a vertex to the end of the zones area at position x,y.
Method VertCount:Int()
ReturnsThe number of vertex in the zones area.
DescriptionCounts the number of vertex in the zones area.
Method VertGetPosition( index:Int, x:Float Var, y:Float Var )
DescriptionGets a vertex's position.
InformationSets x and y to the vertex's position. The values area given in the zones local coordinate system. i.e. As if the zone wasn't rotated, positioned or scaled.
Method VertGetX:Float( index:Int )
ReturnsThe vertex's x coordinate.
DescriptionGets the vertex's x coordinate.
Method VertGetY:Float( index:Int )
ReturnsThe vertex's y coordinate.
DescriptionGets the vertex's y coordinate.
Method VertInsert( index:Int, x:Float, y:Float )
DescriptionAdds a vertex to a zones area.
InformationInserts a vertex into a zones area at index and at position x,y.
Method VertPosition( index:Int, x:Float, y:Float )
DescriptionPositions a vertex.
InformationMoves vertex index to position x,y. VertPosition uses the zones local coordinate system. This means x,y is the position if the zone isn't rotated, positioned or scaled.
Method VertRemove( index:Int )
DescriptionRemoves a vertex from a zones area.
InformationRemoves vertex index from the zones area.
Method VertRemoveFirst()
DescriptionRemoves a vertex from the zones area.
InformationRemoves the last vertex from a zone area.
Method VertRemoveLast()
DescriptionRemoves a vertex from the zones area.
InformationRemoves the last vertex from a zone.
Function ApplyToActive( ApplyFunc( zone:TZone ) )
DescriptionMaps one function to all active TZones.
InformationApplyFunc is the function that will be run for every active TZone in the simulation.
Function CountActive:Int()
ReturnsThe number of active TZones.
DescriptionCounts the number of active TZones.
InformationCountActive only counts TZones that have been activated.
Function Create:TZone( area:Float[], style:Int=LINE, frict:Float=1.0, colGroup:Int=-1, qtLevel:Int=1 )
ReturnsCollision zone created.
DescriptionCreates a new collision zone.
InformationA collision zone is an area of the simulation that masses can collide with. The collision area is difined by an array of x:Float,y:Float coordinate pairs. Style can be either LINE, LOOP, FILL, or HOLE. colGroup relates to which masses will collide with the zone. See Create for more information. qtLevel is the number of levels in the zones QuadTree. A value of 1 is the same as having bounding checks and is sufficient in most cases. QuadTree creation is slow so setting qtLevel too high can cause massive delays in an application.
Function Load:TZone( url:Object, active:Int=True )
ReturnsLoaded collision zone.
DescriptionLoads a saved collision zone.
Informationurl is the file where the TZone is saved. The zones QuadTree is also loaded so does not need to be recalculated.

Module Information

Version1.12
AuthorDavid Williamson
Copyright2006-2009 David Williamson
History1.12 Release
Added CountActive, ApplyToActive, Activate and DeActivate to TZone. Added GetAdvBody and GetIndex to TRig.
Altered friction handling to eliminate sliding. Added CountActive, ApplyToActive, GetAdvBody, IsActive and GetIndex to TMass.
Added CountActive, ApplyToActive, GetAdvBody, IsActive and GetIndex to TConstraint.
Added CountAll, ApplyToAll, Freeze, Thaw, Free, MassGet, ConGet and RigGet to TTAdvBody.
History1.11 Release
Added Load, Save, Copy, SetName, GetName, GetX, GetY, GetQTLevel, GetRotation, GetFriction, SetStyle and GetStyle to TZone.
Added VertCount, VertAddLast, VertAddFirst, VertInsert, VertRemoveLast, VertRemoveFirst, and VertRemove to TZone.
Added VertPosition, VertGetPosition, VertGetX, and VertGetY to TZone.
Added SetBlend, GetBlend, SetAlpha, GetAlpha, SetColor, GetColor, SetScale, GetScale, ImageSetScale and ImageGetScale to TZone.
Added DrawRect to TPhysics. Added DrawQuadTree to TZone and fixed Draw.
TAdvBody.Save now packs images into .plb file. Optimized TQuadTree and fixed HOLE creation bug.
History1.10 Release
Added SetBlend and GetBlend to TRig. Added GetBounds to TPhysics.
Added ImageReplace, RigSetScale, RigGetScale, RigSetColor, RigGetColor, RigSetAlpha, RigGetAlpha, RigSetBlend and RigGetBlend to TAdvBody.
Updated TAdvBody.Load and TAdvBody.Copy to use new TRig functions.
History1.09 Release
Added SetScale, GetScale, SetColor, GetColor, SetAlpha, GetAlpha, GetImage, GetMass and
GetConstraint to TRig.
History1.08 Release
Added GetX, GetY, MassDrawAll and ConDraw to TAdvBody. Fixed TAdvBody method ConAddAll.
Added SimX and SimY to TPhysics. Added GetFriction to TMass.
History1.07 Release
Added MassCleanIndex, ConCleanIndex, RigCleanIndex, ImageCleanIndex and CleanIndex to TAdvBody.
Added MassSwapIndex, ConSwapIndex, RigSwapIndex and ImageSwapIndex to TAdvBody.
History1.06 Release
Added GetAngle to TRig. Fixed TAdvBody.Load on PowerPC's.
Added SetDrawRotation, DrawPoly, DrawLine, DrawOval and UpdateTransform to TPhysics.
History1.05 Release
Added ScreenX and ScreenY functions to TPhysics. Added TColEvent type.
Added CollideAdvBody, CollideZone and CollideBounds methods to TAdvBody.
History1.04 Release
Added HOLE style, and the methods Turn, OverrideCollision, SetImage and Draw to TZone.
Added MouseX, MouseY, DrawImage, SetDrawZoom and SetDrawCoords to TPhysics.
History1.03 Release
Added TAdvBody type. Added procedural functions. Added IsFrozen method to TMass.
Added SetColGroup and GetColGroup to TZone.
History1.02 Release
Added TMass methods GetPosition, GetX, GetY, GetVX, GetVY and GetMass. Fixed TConstraint Method GetStiffness.
History1.01 Release
Added shifted grid occlusion
History1.00 Release
First release.