ODD.PhysLite: | Functions | Types | Modinfo | Source |
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. |
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. |
Function AdvBodyApplyToAll( ApplyFunc( advBody:TAdvBody ) ) | |
Description | Maps one function to all TAdvBodies. |
Information | ApplyFunc is the function that will be run for every active TAdvBody in the simulation. |
Function AdvBodyCountAll:Int() | |
Returns | The number of TAdvBodies. |
Description | Counts all TAdvBodies. |
Information | AdvBodyCountAll will include TAdvBodies that are not active. |
Function AdvBodyLoad:TAdvBody( url:Object, active:Int=False ) | |
Returns | Loaded TAdvBody. |
Description | Loads a previously saved advanced body object. |
Information | The 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 ) | |
Returns | The created collision event. |
Description | Creates a collision event object. |
Information | Craetes a collision event that can then be emitted or posted.
See Also: ColEventEmit and ColEventPost. |
Function ColEventEmit( colEvent:TColEvent ) | |
Description | Emits a collision event. |
Information | When 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() | |
Description | Clears the collision event queue. |
Information | After 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() | |
Returns | the last polled collision event. |
Description | Gets the last polled collision event. |
Information | If no collision event has been polled yet or an empty queue has been polled then ColEventGetCurrent returns Null. |
Function ColEventPeek:TColEvent() | |
Returns | The next collision event. |
Description | Gets the next collision event from the queue. |
Information | Similar to ColEventPoll, however ColEventPeek does not remove the event from the queue.
See Also: ColEventPoll, ColEventSeek and CollEventGetCurrent. |
Function ColEventPoll:TColEvent() | |
Returns | The next collision event in the queue. |
Description | Removes the next collision event from the queue. |
Information | ColEventPoll 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 ) | |
Description | Posts a collision event to the collision events queue. |
Information | Similar 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 ) | |
Returns | The collision event found. |
Description | Gets the collision event associated with two objects. |
Information | ColEventSeek 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 ) | |||||||
Description | Sets how collision events are added to the event queue. | ||||||
Information | Sets 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.
|
Function ConApplyToActive( ApplyFunc( con:TConstraint ) ) | |
Description | Maps one function to all active TConstraints. |
Information | ApplyFunc is the function that will be run for every active TConstraint in the simulation. |
Function ConCountActive:Int() | |
Returns | The number of active TConstraints. |
Description | Counts the number of active TConstraints. |
Information | ConCountActive only counts TConstraints that are associated with a TBody. |
Function ConCreate:TConstraint( m1:TMass, m2:TMass, restLength:Float=-1, stiffness:Float=1.0 ) | |
Returns | Created TConstraint. |
Description | Creates a new TConstraint object. |
Information | A 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 ) ) | |
Description | Maps one function to all active TMass objects. |
Information | ApplyFunc is the function that will be run for every active TMass in the simulation. |
Function MassCountActive:Int() | |
Returns | The number of active TMass objects. |
Description | Counts the number of active TMass objects. |
Information | MassCountActive 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 ) | |
Returns | Created TMass. |
Description | Creates a mass object. |
Information | The 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 ) | |
Returns | A TPhysics object. |
Description | Creates a new physics simulation. |
Information | Creates 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 ) | |
Description | Draws an image. |
Information | Draws 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 ) | |
Description | Draws a line. |
Information | Draws 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 ) | |
Description | Draws an oval. |
Information | Draws 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 ) | |
Description | Draws a polygon. |
Information | Draws 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 ) | |
Description | Draws a rectangle. |
Information | Draws 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() | |
Description | Ends the physics simulation. |
Information | See Also: PhysicsBegin. |
Function PhysicsGetBounds( lowerX:Float Var, lowerY:Float Var, upperX:Float Var, upperY:Float Var ) | |
Description | Get the upper and lower bounds of the simulation. |
Information | See Also: PhysicsSetBounds. |
Function PhysicsMouseX:Float() | |
Returns | Mouse X coordinate. |
Description | Gets the mouse X coordinate. |
Information | MouseX returns the simulation X coordinate of the mouse cursor.
See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseY, PhysicsSimX, PhysicsSimY, PhysicsScreenX and PhysicsScreenY. |
Function PhysicsMouseY:Float() | |
Returns | Mouse Y coordinate. |
Description | Gets the mouse Y coordinate. |
Information | MouseY 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 ) | |
Returns | The screen x coordinate of simulation x,y coordinate. |
Description | Gets the screen x coordinate. |
Information | See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsSimY and PhysicsScreenY. |
Function PhysicsScreenY:Float( valueX:Float, valueY:Float ) | |
Returns | The screen y coordinate of simulation x,y coordinate. |
Description | Gets the screen y coordinate. |
Information | See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsSimY and PhysicsScreenX. |
Function PhysicsSetBounds( lowerX:Float, lowerY:Float, upperX:Float, upperY:Float ) | |
Description | Set the upper and lower bounds of the simulation. |
Information | See Also: PhysicsGetBounds and PhysicsSetFriction. |
Function PhysicsSetDrawCoords( centerX:Float, centerY:Float ) | |
Description | Set the area of simulation to draw. |
Information | centerX 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 ) | |
Description | Sets the angle at which to draw the simulation. |
Information | SetDrawRotation 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 ) | |
Description | Set the zoom of the draw commands. |
Information | PhysicsSetDrawZoom 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 ) | |
Description | Set the friction of the simulations bounds. |
Information | See Also: PhysicsSetBounds. |
Function PhysicsSetGravity( x:Float, y:Float ) | |
Description | Sets the simulation gravity. |
Information | Gravity can go in any direction dictated by the vector x, y. |
Function PhysicsSetGridSize( value:Int ) | |
Description | Set the size of the shifted grid. |
Information | The 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 ) | |
Description | The number of iterations used by the simulation. |
Information | The 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 ) | |
Returns | Simulation X coordinate. |
Description | Gets the simulation X coordinate of a screen x,y location. |
Information | See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimY, PhysicsDrawOval, PhysicsScreenX and PhysicsScreenY. |
Function PhysicsSimY:Float( x:Float, y:Float ) | |
Returns | Simulation Y coordinate. |
Description | Gets the simulation Y coordinate of a screen x,y location. |
Information | See Also: PhysicsSetDrawCoords, PhysicsSetDrawZoom, PhysicsSetDrawRotation, PhysicsUpdateTransform, PhysicsMouseX, PhysicsMouseY, PhysicsSimX, PhysicsScreenX and PhysicsScreenY. |
Function PhysicsUpdate() | |
Description | Update simulation. |
Information | Process the physics iterations and responses.
PhysicsUpdate will Flush the event collision queue, and repopulate it.
See Also: PhysicsBegin and PhysicsEnd. |
Function PhysicsUpdateTransform() | |
Description | Updates the transform/rotation matrix. |
Information | Under 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 ) | |
Description | Activate or de-activate the use of the shifted grid for TMass occlusion. |
Information | Set 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 ) | |
Returns | Created TRig. |
Description | Creates a new TRig. |
Information | Creates 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 ) ) | |
Description | Maps one function to all active TZones. |
Information | ApplyFunc is the function that will be run for every active TZone in the simulation. |
Function ZoneCountActive:Int() | |
Returns | The number of active TZones. |
Description | Counts the number of active TZones. |
Information | ZoneCountActive 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 ) | |
Returns | Collision zone created. |
Description | Creates a new collision zone. |
Information | A 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 ) | |
Returns | Loaded collision zone. |
Description | Loads a saved collision zone. |
Information | url is the file where the TZone is saved. The zones QuadTree is also loaded so does not need to be recalculated. |
Type TAdvBody Extends TBody | |
Description | Advanced 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() | |
Description | Activates the TAdvBody. |
Information | When 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() | |
Description | Removes blank indices from the TAdvBody. |
Information | CleanIndex 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 ) | |
Returns | A list of Collision Events. |
Description | Retrieves the collisions between TAdvBody's. |
Information | Checks 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() | |
Returns | A list of Collision Events. |
Description | Retreives all the collisions between the TAdvBody and the simulations bounds. |
Information | Checks 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 ) | |
Returns | A list of Collision Events. |
Description | Retreives all the collisions between the TAdvBody and a TZone. |
Information | Checks 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 ) | |
Returns | The index of the created constraint. |
Description | Creates and adds a constraint to the TAdvBody. |
Information | Creates 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 ) | |
Description | A shortcut method to connect all the masses in a TAdvBody. |
Information | ConAddAll 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() | |
Description | Condenses the indices of the constraints. |
Information | ConCleanIndex 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 ) | |
Returns | True if constraint exists, false if otherwise. |
Description | Sees if constraint exists. |
Information | Not 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 ) | |
Returns | The TConstraint at index. |
Description | Gets a TConstraint component. |
Information | ConGet returns the TConstraint at the given index. |
Method ConMaxIndex:Int() | |
Returns | Maximum index. |
Description | Get the maximum constraint index used by the TAdvBody. |
Information | note ConMaxIndex returns the maximum index that has been used by the TAdvBody. The actual maximum index may be lower. |
Method ConRemove( index:Int ) | |
Description | Removes a constraint from the TAdvBody. |
Information | Removes 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 ) | |
Description | Swaps the index positions of two constraints. |
Method Copy:TAdvBody( active:Int=False ) | |
Returns | The copied TAdvBody. |
Description | Copies the advanced body object. |
Information | Creates 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() | |
Description | Deactivates the TAdvBody. |
Information | Stops the TAdvBody from being active in the simulation. |
Method Draw() | |
Description | Draws the TAdvBody. |
Information | the Draw method draws all the rigs associated with the TAdvBody. |
Method Free() | |
Description | Frees the TAdvBody. |
Information | Use free when the TAdvBody is no longer needed to free it from memory. |
Method Freeze() | |
Description | Freezes all the bodies masses. |
Method GetPosition( x:Float Var, y:Float Var ) | |
Description | Gets the position of the TAdvBody. |
Information | GetPosition 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() | |
Returns | The angle of the constraint with the lowest index. |
Description | Gets the angle of the TAdvBody. |
Method GetX:Float() | |
Returns | the X coordinate of the TAdvBody. |
Description | Gets the X coordinate of the TAdvBody position. |
Information | See also: GetPosition. |
Method GetY:Float() | |
Returns | the Y coordinate of the TAdvBody. |
Description | Gets the Y coordinate of the TAdvBody position. |
Information | See also: GetPosition. |
Method ImageAdd:Int( url:Object ) | |
Returns | The index of the image. |
Description | Adds an image to the TAdvBody. |
Information | An 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() | |
Description | Condenses the indices of the images. |
Information | ImageCleanIndex 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 ) | |
Returns | True if image exists, false if otherwise. |
Description | Sees if image exists. |
Information | Not 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 ) | |
Returns | TImage at index. |
Description | Gets the image at index. |
Information | Use 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() | |
Returns | Maximum index. |
Description | Get the maximum image index used by the TAdvBody. |
Information | Note ImageMaxIndex returns the maximum index that has been used by the TAdvBody. The actual maximum index may be lower. |
Method ImageRemove( index:Int ) | |
Description | Removes an image from the TAdvBody. |
Information | Removes 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 ) | |
Returns | True if replace was successful. |
Description | Replaces one image with another. |
Information | Replaces the image at index with another image. This function is mainly useful when creating editors. |
Method ImageSwapIndex( index1:Int, index2:Int ) | |
Description | Swaps the index positions of two rigs. |
Method MassAdd:Int( x:Float, y:Float, mass:Float, radius:Float, friction:Float, colGroup:Int=-1 ) | |
Returns | The index of the created mass. |
Description | Creates and adds a mass to the TAdvBody. |
Information | Creates a mass associated with the TAdvBody and returns it's index. See TMass.Create for more information. |
Method MassCleanIndex() | |
Description | Condenses the indices of the masses. |
Information | MassCleanIndex 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 ) | |
Returns | True if mass exists, false if otherwise. |
Description | Sees if mass exists. |
Information | Not 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 ) | |
Returns | The TMass at index. |
Description | Gets a TMass component. |
Information | MassGet returns the TMass at the given index. |
Method MassMaxIndex:Int() | |
Returns | Maximum index. |
Description | Get the maximum mass index used by the TAdvBody. |
Information | note MassMaxIndex returns the maximum index that has been used by the TAdvBody. The actual maximum index may be lower. |
Method MassRemove( index:Int ) | |
Description | Removes a mass from the TAdvBody. |
Information | Removes 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 ) | |
Description | Swaps the index positions of two masses. |
Method Move( x:Float, y:Float ) | |
Description | Moves the TAdvBody. |
Information | The Move method moves all the masses associated with the TAdvBody. |
Method Position( x:Float, y:Float) | |
Description | Position the TAdvBody. |
Information | The 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 ) | |
Returns | The index of the created rig. |
Description | Creates and adds a rig to the TAdvBody. |
Information | Creates 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() | |
Description | Condenses the indices of the rigs. |
Information | RigCleanIndex 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 ) | |
Returns | True if rig exists, false if otherwise. |
Description | Sees if rig exists. |
Information | Not 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 ) | |
Returns | The TRig at index. |
Description | Gets a TRig component. |
Information | RigGet returns the TRig at the given index. |
Method RigMaxIndex:Int() | |
Returns | Maximum index. |
Description | Get the maximum rig index used by the TAdvBody. |
Information | Note RigMaxIndex returns the maximum index that has been used by the TAdvBody. The actual maximum index may be lower. |
Method RigRemove( index:Int ) | |
Description | Removes a rig from the TAdvBody. |
Information | Removes 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 ) | |
Description | Swaps the index positions of two rigs. |
Method Rotate( angle:Float ) | |
Description | Rotates TAdvBody. |
Information | The 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 ) | |
Description | Saves the advanced body object. |
Information | Saves 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 ) | |
Description | Spins the TAdvBody. |
Information | The 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() | |
Description | Thaws all the bodies masses. |
Method Translate( x:Float, y:Float ) | |
Description | Translates the TAdvBody. |
Information | The Translate method translates all the masses associated with the TAdvBody. |
Method Turn( angle:Float ) | |
Description | Turns the TAdvBody. |
Information | The 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 ) ) | |
Description | Maps one function to all TAdvBodies. |
Information | ApplyFunc is the function that will be run for every active TAdvBody in the simulation. |
Function CountAll:Int() | |
Returns | The number of TAdvBodies. |
Description | Counts all TAdvBodies. |
Information | CountAll will include TAdvBodies that are not active. |
Function Load:TAdvBody( url:Object, active:Int=False ) | |
Returns | Loaded TAdvBody. |
Description | Loads a previously saved advanced body object. |
Information | The 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 | |
Description | TBody 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() | |
Description | Deprecated: Use Free instead. |
Information | Deprecated: Use Free instead. |
Method Free() | |
Description | Frees all constraints from TBody. |
Information | Frees all constraints that are currently assigned to the TBody. Use Free when a body is no longer needed. |
Method GetConstraints:TList() | |
Returns | list of constraints. |
Description | Gets bodies constraints. |
Information | Creates a list containing all the Constraints associsted with the TBody object. |
Method GetName:String() | |
Description | Gets bodies name. |
Method SetName( n:String ) | |
Description | Sets bodies name. |
Type TColEvent | |
Description | Collision 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 | |
Description | The collision event hook ID. |
Information | The hook event which can be used by AddHook to add a hook function. |
Method GetForce:Float() | |
Returns | The force of the collision. |
Description | Get the force of the collision event. |
Information | Because 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() | |
Returns | The ID of the collision object. |
Description | Gets the ID of the collision object. |
Information | The 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() | |
Returns | The first TMass associated with the collision event. |
Description | Gets the first TMass associated with the collision event. |
Information | Collision events must always have at least one TMass associated with them. Use GetMass1 to retrieve that TMass. |
Method GetMass2:TMass() | |
Returns | The second TMass associated with the collision event. |
Description | Gets the second TMass associated with the collision event. |
Information | If there isn't a second TMass associated with the collision event then GetMass2 returns Null. |
Method GetX:Float() | |
Returns | The x coordinate of the collision. |
Description | Get the x coordinate of the collision event. |
Method GetY:Float() | |
Returns | The y coordinate of the collision. |
Description | Get the y coordinate of the collision event. |
Method GetZone:TZone() | |
Returns | The TZone associated with the collision event. |
Description | Gets the TZone associated with the collision event. |
Information | If 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 ) | |
Returns | The created collision event. |
Description | Creates a collision event object. |
Information | Craetes a collision event that can then be emitted or posted. |
Function Emit( colEvent:TColEvent ) | |
Description | Emits a collision event. |
Information | When 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() | |
Description | Clears the collision event queue. |
Information | After 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() | |
Returns | the last polled collision event. |
Description | Gets the last polled collision event. |
Information | If no collision event has been polled yet or an empty queue has been polled then GetCurrent returns Null. |
Function Peek:TColEvent() | |
Returns | The next collision event. |
Description | Gets the next collision event from the queue. |
Information | Similar to Poll, however Peek does not remove the event from the queue. |
Function Poll:TColEvent() | |
Returns | The next collision event in the queue. |
Description | Removes the next collision event from the queue. |
Information | Poll 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 ) | |
Description | Posts a collision event to the collision events queue. |
Information | Similar 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 ) | |
Returns | The collision event found. |
Description | Gets the collision event associated with two objects. |
Information | Seek 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 ) | |
Description | Sets how collision events are added to the event queue. |
Information | Sets 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 | |
Description | Constraint 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 ) | |
Description | Assigns constraint to a TBody. |
Information | A constraint must be assigned to a TBody before it becomes active. |
Method Draw() | |
Description | Draws the TConstraint. |
Method Free( b:TBody ) | |
Description | Frees constraint from TBody. |
Information | Note: 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() | |
Returns | The TAdvBody of the constraint. |
Description | Gets the TAdvBody that the constraint is associated with. |
Information | GetAdvBody returns null if the constraint isn't associated with an TAdvBody. |
Method GetAngle:Float() | |
Returns | Current angle. |
Description | Gets the current angle of the constraint. |
Information | This is the angle from mass1 to mass2. |
Method GetIndex:Int() | |
Returns | The index of the constraint. |
Description | Gets the index of the constraint. |
Information | GetIndex returns -1 if the constraint isn't associated with an TAdvBody. |
Method GetLength:Float() | |
Returns | Length. |
Description | Gets the constraints actual length. |
Information | GetLength is used to find the current length of the constraint. |
Method GetMass1:TMass() | |
Description | Gets the first mass associated with the constraint. |
Information | Each constraint has two masses associated with it. GetMass1 returns the first, to get the second use GetMass2. |
Method GetMass2:TMass() | |
Description | Gets the second mass associated with the constraint. |
Information | Each constraint has two masses associated with it. GetMass2 returns the second, to get the first use GetMass1. |
Method GetName:String() | |
Returns | Constraints name. |
Description | Gets constraints name. |
Method GetRestLength:Float() | |
Returns | Rest length. |
Description | Gets the constraints rest length. |
Information | Note: 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() | |
Returns | Current stiffness. |
Description | Gets current stiffness. |
Method GetStress:Float() | |
Returns | Stress ratio. |
Description | Gets the current stress of the constraint. |
Information | A 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() | |
Returns | True if constraint is active. |
Description | Checks if constraint is currently active in the simulation. |
Method SetName( n:String ) | |
Description | Sets constraints name. |
Method SetRestLength( length:Float=-1 ) | |
Description | Sets the constraints rest length. |
Information | The constraints rest length is the length the constraint attempts to maintain. |
Method SetStiffness( stiff:Float ) | |
Description | Sets constraints stiffness. |
Information | Stiffnes should be within the range 0.0 to 1.0. |
Function ApplyToActive( ApplyFunc( con:TConstraint ) ) | |
Description | Maps one function to all active TConstraints. |
Information | ApplyFunc is the function that will be run for every active TConstraint in the simulation. |
Function CountActive:Int() | |
Returns | The number of active TConstraints. |
Description | Counts the number of active TConstraints. |
Information | CountActive only counts TConstraints that are associated with a TBody. |
Function Create:TConstraint( m1:TMass, m2:TMass, restLength:Float=-1, stiffness:Float=1.0 ) | |
Returns | Created TConstraint. |
Description | Creates a new TConstraint object. |
Information | A 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 | |
Description | Mass 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 ) | |
Description | Alters masses velocity. |
Information | AddVelocity differs from SetVelocity in that the masses current velocity is added to instead of replaced by X and Y. |
Method Copy:TMass() | |
Returns | TMass Copy. |
Description | Creates a copy of the mass. |
Method Draw() | |
Description | Draws the TMass. |
Method Freeze() | |
Description | Freezes TMass. |
Information | Freezing 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() | |
Returns | The TAdvBody of the mass. |
Description | Gets the TAdvBody that the mass is associated with. |
Information | GetAdvBody returns null if the mass isn't associated with an TAdvBody. |
Method GetColGroup:Int() | |
Returns | Collision group. |
Description | Returns masses collision group. |
Method GetFriction:Float() | |
Returns | Current friction coefficient. |
Description | Gets the current friction coefficient of the TMass object. |
Method GetIndex:Int() | |
Returns | The index of the mass. |
Description | Gets the index of the mass. |
Information | GetIndex returns -1 if the mass isn't associated with an TAdvBody. |
Method GetMass:Float() | |
Returns | Current mass. |
Description | Gets the current mass of the TMass object. |
Method GetName:String() | |
Description | Gets masses name. |
Method GetPosition( x:Float Var, y:Float Var ) | |
Description | Sets x and y to masses position. |
Method GetPositionX:Float() | |
Returns | masses X coordinate. |
Description | Gets masses current X coordinate. |
Method GetPositionY:Float() | |
Returns | Masses Y coordinate. |
Description | Gets masses current Y coordinate. |
Method GetRadius:Float() | |
Description | Gets the collision radius of the mass. |
Method GetVelocity:Float() | |
Description | Gets the magnitude of the TMass objects velocity vector. |
Method GetVelocityX:Float() | |
Returns | Masses x velocity. |
Description | Gets TMass objects X velocity. |
Method GetVelocityY:Float() | |
Returns | Masses y velocity. |
Description | Gets TMass objects Y velocity. |
Method GetVX:Float() | |
Returns | Masses x velocity. |
Description | Gets TMass objects X velocity. |
Information | Short hand version of GetVelocityX. |
Method GetVY:Float() | |
Returns | Masses y velocity. |
Description | Gets TMass objects Y velocity. |
Information | Short hand version of GetVelocityY. |
Method GetX:Float() | |
Returns | masses X coordinate. |
Description | Gets masses current X coordinate. |
Information | Short hand version of GetPositionX. |
Method GetY:Float() | |
Returns | Masses Y coordinate. |
Description | Gets masses current Y coordinate. |
Information | Short hand version of GetPositionY. |
Method IsActive:Int() | |
Returns | True if mass is active. |
Description | Checks if mass is currently active in the simulation. |
Method Move( x:Float, y:Float ) | |
Description | Moves TMass relative to it's current position. |
Information | When 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 ) | |
Description | Sets masses absolute position. |
Information | Positioning a mass also resets it's velocity. Position may be used on a frozen mass. |
Method SetColGroup( value:Int=-1 ) | |
Description | Sets masses collision group. |
Information | 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. |
Method SetFriction( f:Float ) | |
Description | Sets masses friction. |
Information | Friction should always be positive. |
Method SetMass( m:Float ) | |
Description | Sets the current mass of the TMass object. |
Information | Mass should always be positive. |
Method SetName( n:String ) | |
Description | Sets masses name. |
Method SetRadius( r:Float ) | |
Description | Sets the collision radius of the mass. |
Method SetVelocity( x:Float, y:Float ) | |
Description | Sets masses velocity. |
Information | Sets the masses velocity. |
Method Thaw() | |
Description | Thaws TMass. |
Information | Thaw unfreezes the TMass. |
Method Translate( x:Float, y:Float ) | |
Description | Translates TMass. |
Information | Translate 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 ) ) | |
Description | Maps one function to all active TMass objects. |
Information | ApplyFunc is the function that will be run for every active TMass in the simulation. |
Function CountActive:Int() | |
Returns | The number of active TMass objects. |
Description | Counts the number of active TMass objects. |
Information | CountActive 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 ) | |
Returns | Created TMass. |
Description | Creates a mass object. |
Information | The 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 | |
Description | Physics 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 ) | |
Returns | A TPhysics object. |
Description | Creates a new physics simulation. |
Information | Note: that the gravity gravY parameter is before the gravX parameter. |
Function DrawImage( image:TImage, x:Float, y:Float, frame:Int=0 ) | |
Description | Draws an image. |
Information | Draws an image at simulation coordinates x,y and with the correct rotation. |
Function DrawLine( x:Float, y:Float, x2:Float, y2:Float ) | |
Description | Draws a line. |
Information | Draws a line at the correct simulation coordinates. |
Function DrawOval( x:Float, y:Float, width:Float, height:Float ) | |
Description | Draws an oval. |
Information | Draws an oval at simulation coordinates x,y and with the correct rotation. |
Function DrawPoly( xy:Float[], x:Float=0.0, y:Float=0.0 ) | |
Description | Draws a polygon. |
Information | Draws a polygon at simulation coordinates x,y and with the correct rotation. |
Function DrawRect( x:Float, y:Float, width:Float, height:Float ) | |
Description | Draws a rectangle. |
Information | Draws a rectangle at simulation coordinates x,y and with the correct rotation. |
Function Free() | |
Description | Ends the physics simulation. |
Function GetBounds( lowerX:Float Var, lowerY:Float Var, upperX:Float Var, upperY:Float Var ) | |
Description | Get the upper and lower bounds of the simulation. |
Function MouseX:Float() | |
Returns | Mouse X coordinate. |
Description | Gets the mouse X coordinate. |
Information | MouseX returns the simulation X coordinate of the mouse cursor. |
Function MouseY:Float() | |
Returns | Mouse Y coordinate. |
Description | Gets the mouse Y coordinate. |
Information | MouseY returns the simulation Y coordinate of the mouse cursor. |
Function ScreenX:Float( valueX:Float, valueY:Float ) | |
Returns | The screen x coordinate of simulation x,y coordinate. |
Description | Gets the screen x coordinate. |
Function ScreenY:Float( valueX:Float, valueY:Float ) | |
Returns | The screen y coordinate of simulation x,y coordinate. |
Description | Gets the screen y coordinate. |
Function SetBounds( lowerX:Float, lowerY:Float, upperX:Float, upperY:Float ) | |
Description | Set the upper and lower bounds of the simulation. |
Function SetDrawCoords( centerX:Float, centerY:Float ) | |
Description | Set the area of simulation to draw. |
Information | centerX and centerY are the simulation coordinates to be mapped to the center of the screen. |
Function SetDrawRotation( angle:Float=0 ) | |
Description | Sets the angle at which to draw the simulation. |
Information | SetDrawRotation 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 ) | |
Description | Set the zoom of the draw commands. |
Function SetFriction( frict:Float ) | |
Description | Set the friction of the simulations bounds. |
Function SetGravity( x:Float, y:Float ) | |
Description | Sets the simulation gravity. |
Information | Gravity can go in any direction dictated by the vector x,@y. |
Function SetGridSize( value:Int=8 ) | |
Description | Set the size of the shifted grid. |
Information | The 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 ) | |
Description | The number of iterations used by the simulation. |
Information | The 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 ) | |
Returns | Simulation X coordinate. |
Description | Gets the simulation X coordinate of a screen x,y location. |
Information | . |
Function SimY:Float( x:Float, y:Float ) | |
Returns | Simulation Y coordinate. |
Description | Gets the simulation Y coordinate of a screen x,y location. |
Information | . |
Function Update() | |
Description | Update simulation. |
Information | Process the physics iterations and responses. Update will Flush the event collision queue. |
Function UpdateTransform() | |
Description | Updates the transform/rotation matrix. |
Information | Under 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 ) | |
Description | Activate or de-activate the use of the shifted grid for TMass occlusion. |
Information | Set 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 | |
Description | TRig 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() | |
Description | Draws the TRig. |
Information | Draws 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() | |
Returns | The TAdvBody of the rig. |
Description | Gets the TAdvBody that the rig is associated with. |
Information | GetAdvBody returns null if the rig isn't associated with an TAdvBody. |
Method GetAlpha:Float() | |
Returns | The alpha value of the rig. |
Description | Gets the rigs alpha value. |
Method GetAngle:Float() | |
Returns | The difference between the rigs constraints angle and the angle at which the rigs image will be drawn. |
Description | Gets the rigs angular offset. |
Information | If the rig has no constraint associated with it GetAngle returns the angle at which the rigs image is drawn. |
Method GetBlend:Int() | |
Returns | The rigs current blend mode. |
Description | Gets the rigs current blend mode. |
Information | The returned value will be one of MASKBLEND, SOLIDBLEND, ALPHABLEND, LIGHTBLEND or SHADEBLEND. |
Method GetColor( r:Int Var, g:Int Var, b:Int Var ) | |
Description | Gets the rigs color. |
Information | Sets r, g and b to the red, green and blue values respectively of the rig. |
Method GetConstraint:TConstraint() | |
Returns | The TConstraint of the rig. |
Description | Returns the Tconstraint associated with the TRig. |
Information | GetConstraint 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() | |
Returns | The rigs current image. |
Description | Gets the image currently associated with the TRig. |
Information | GetImage gives you access to the rigs image. |
Method GetIndex:Int() | |
Returns | The index of the rig. |
Description | Gets the index of the rig. |
Information | GetIndex returns -1 if the rig isn't associated with a TAdvBody. |
Method GetMass:TMass() | |
Returns | The TMass object that acts as the rigs handle. |
Description | Gets the mass associated with the TRig. |
Information | GetMass gives you access to the rigs Tmass object. |
Method GetName:String() | |
Description | Gets rigs name. |
Method GetScale( x:Float Var, y:Float Var ) | |
Description | Gets the rigs scale. |
Information | Sets x and y to the rigs current x and y scale. |
Method SetAlpha( value:Float ) | |
Description | Sets the alpha value of the rig. |
Information | The rigs alpha will only have an effect if the rigs blend mode is ALPHABLEND or LIGHTBLEND. |
Method SetAngle( a:Float ) | |
Description | Sets the TRigs angle offset. |
Information | This sets the angular offset from the constraint at which the rig will be drawn. |
Method SetBlend( value:Int ) | |
Description | Sets the rigs blend mode. |
Information | Value should be one of MASKBLEND, SOLIDBLEND, ALPHABLEND, LIGHTBLEND or SHADEBLEND. |
Method SetColor( r:Int, g:Int, b:Int ) | |
Description | Sets the tint of the rig. |
Information | SetColor sets the color tint that the rig will be drawn with. |
Method SetConstraint( c:TConstraint=Null ) | |
Description | Sets the TRigs constraint. |
Information | The constraints orientation determines the rigs rotation. |
Method SetImage( img:TImage ) | |
Description | Sets the TRigs image. |
Method SetMass( m:TMass ) | |
Description | Sets the TRigs mass. |
Method SetName( n:String ) | |
Description | Sets rigs name. |
Method SetScale( valueX:Float, valueY:Float ) | |
Description | Sets the scale at which the rig is drawn. |
Information | Sets the x and y scale of the rigs image. |
Function Create:TRig( image:TImage, mass:TMass, con:TConstraint=Null, angle:Float=0 ) | |
Returns | Created TRig. |
Description | Creates a new TRig. |
Information | Creates 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 | |
Description | Collision 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() | |
Description | Makes the collision zone active in the simulation. |
Information | Activates a de-active collision zone. |
Method CalcQuadTree( level:Int=1 ) | |
Description | Recalculates zones QuadTree. |
Method Copy:TZone() | |
Returns | The zones copy. |
Description | Cretaes a copy of the zone. |
Information | The 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() | |
Description | De-activates collision zone. |
Information | A de-active collision zone does not create collision events or responses. |
Method Draw() | |
Description | Draws the TZone. |
Information | Draws 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 ) | |
Description | Draws the images quadtree. |
Information | DrawQuadTree is too slow for serious realtime use, but can be an invaluable debugging tool. |
Method Free() | |
Description | Removes TZone from the simulation. |
Method GetAlpha:Float() | |
Returns | The zones alpha. |
Description | Gets the zones current alpha. |
Method GetArea:Float[]() | |
Returns | Collision zone. |
Description | Gets the zones area. |
Information | GetArea 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() | |
Returns | The zones blend mode. |
Description | Gets the zones current blend mode. |
Method GetColGroup:Int() | |
Returns | Zones collision group. |
Description | Gets the collision group of the TZone. |
Method GetColor( r:Int Var, g:Int Var, b:Int Var ) | |
Description | Gets the zones current color setting. |
Information | Sets r, g and b to the zones current red, green and blue value respectively. |
Method GetFriction:Float() | |
Returns | The zones friction. |
Description | Gets the zones friction value. |
Method GetName:String() | |
Returns | The zones name. |
Description | Gets the zones name. |
Method GetPositionX:Float() | |
Description | Gets the current X position of the TZone. |
Method GetPositionY:Float() | |
Description | Gets the current Y position of the TZone. |
Method GetQTLevel:Int() | |
Returns | The zones quadtree level. |
Description | Gets the zones current quadtree level. |
Method GetRotation:Float() | |
Returns | The zones rotation. |
Description | Gets the current rotation of the zone. |
Method GetScale( x:Float Var, y:Float Var ) | |
Description | Gets the zones scale. |
Information | Sets x and y to the zones current scale. |
Method GetStyle:Int() | |
Returns | The zones current style. |
Description | Gets the zones current style. |
Information | GetStyle returns either LINE, LOOP, FILL, or HOLE. |
Method GetX:Float() | |
Description | Gets the current X position of the TZone. |
Method GetY:Float() | |
Description | Gets the current Y position of the TZone. |
Method ImageGet:TImage() | |
Returns | The zones current image. |
Description | Gets the zones current image. |
Information | ImageGet returns null if no image is associated with the zone. |
Method ImageGetScale( x:Float Var, y:Float Var ) | |
Description | Gets the zones current image scale. |
Information | Sets x and y to the zones images current scale. |
Method ImageSetScale( x:Float, y:Float ) | |
Description | Sets the zones image scale. |
Information | Sets 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 ) | |
Description | Moves the collision zone relative to it's current position. |
Information | TZones 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 ) | |
Description | Sets the function to be used for collisions. |
Information | If no function is named the default collision function will be used. Recommended for advanced users only. |
Method Position( x:Float, y:Float ) | |
Description | Positions the collision zone within the simulation. |
Method Rotate( value:Float ) | |
Description | Rotates collision zone. |
Information | Not recommended for realtime use. |
Method Save( url:Object, backup:Int=True, packImage:Int=True ) | |
Description | Saves a collision zone. |
Information | Saves 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 ) | |
Description | Sets the zones alpha. |
Information | SetAlpha will only have an effect on zones with the alpha or light blend mode. |
Method SetBlend( value:Int ) | |
Description | Sets the zones blend mode. |
Information | Value can be one of MASKBLEND, SOLIDBLEND, ALPHABLEND, LIGHTBLEND or SHADEBLEND. |
Method SetColGroup( value:Int=-1 ) | |
Description | Sets the zones collision group. |
Information | For more info on collision groups see SetColGroup. |
Method SetColor( r:Int, g:Int, b:Int ) | |
Description | Sets the zones color. |
Information | If 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 ) | |
Description | Sets collision zones friction. |
Information | Friction should always be positive. |
Method SetName( n:String ) | |
Description | Sets the zones name. |
Method SetScale( x:Float, y:Float ) | |
Description | Sets the zones scale. |
Information | SetZone scales the collision zone by x and y. SetScale will also affect the zones image scale. |
Method SetStyle( value:Int ) | |||||||||
Description | Sets the zones style. | ||||||||
Information | A zones style determines how TMass objects collide with it.
Value can be either LINE, LOOP, FILL, or HOLE.
|
Method Turn( value:Float ) | |
Description | Turns collision zone. |
Information | Not recommended for realtime use. |
Method VertAddFirst( x:Float, y:Float ) | |
Description | Adds a vertex to the zones area. |
Information | Adds a vertex to the beginning of the zones area at position x,y. |
Method VertAddLast( x:Float, y:Float ) | |
Description | Adds a vertex to the zones area. |
Information | Adds a vertex to the end of the zones area at position x,y. |
Method VertCount:Int() | |
Returns | The number of vertex in the zones area. |
Description | Counts the number of vertex in the zones area. |
Method VertGetPosition( index:Int, x:Float Var, y:Float Var ) | |
Description | Gets a vertex's position. |
Information | Sets 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 ) | |
Returns | The vertex's x coordinate. |
Description | Gets the vertex's x coordinate. |
Method VertGetY:Float( index:Int ) | |
Returns | The vertex's y coordinate. |
Description | Gets the vertex's y coordinate. |
Method VertInsert( index:Int, x:Float, y:Float ) | |
Description | Adds a vertex to a zones area. |
Information | Inserts a vertex into a zones area at index and at position x,y. |
Method VertPosition( index:Int, x:Float, y:Float ) | |
Description | Positions a vertex. |
Information | Moves 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 ) | |
Description | Removes a vertex from a zones area. |
Information | Removes vertex index from the zones area. |
Method VertRemoveFirst() | |
Description | Removes a vertex from the zones area. |
Information | Removes the last vertex from a zone area. |
Method VertRemoveLast() | |
Description | Removes a vertex from the zones area. |
Information | Removes the last vertex from a zone. |
Function ApplyToActive( ApplyFunc( zone:TZone ) ) | |
Description | Maps one function to all active TZones. |
Information | ApplyFunc is the function that will be run for every active TZone in the simulation. |
Function CountActive:Int() | |
Returns | The number of active TZones. |
Description | Counts the number of active TZones. |
Information | CountActive 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 ) | |
Returns | Collision zone created. |
Description | Creates a new collision zone. |
Information | A 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 ) | |
Returns | Loaded collision zone. |
Description | Loads a saved collision zone. |
Information | url is the file where the TZone is saved. The zones QuadTree is also loaded so does not need to be recalculated. |
Version | 1.12 |
---|---|
Author | David Williamson |
Copyright | 2006-2009 David Williamson |
History | 1.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. | |
History | 1.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. | |
History | 1.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. | |
History | 1.09 Release |
Added SetScale, GetScale, SetColor, GetColor, SetAlpha, GetAlpha, GetImage, GetMass and | |
GetConstraint to TRig. | |
History | 1.08 Release |
Added GetX, GetY, MassDrawAll and ConDraw to TAdvBody. Fixed TAdvBody method ConAddAll. | |
Added SimX and SimY to TPhysics. Added GetFriction to TMass. | |
History | 1.07 Release |
Added MassCleanIndex, ConCleanIndex, RigCleanIndex, ImageCleanIndex and CleanIndex to TAdvBody. | |
Added MassSwapIndex, ConSwapIndex, RigSwapIndex and ImageSwapIndex to TAdvBody. | |
History | 1.06 Release |
Added GetAngle to TRig. Fixed TAdvBody.Load on PowerPC's. | |
Added SetDrawRotation, DrawPoly, DrawLine, DrawOval and UpdateTransform to TPhysics. | |
History | 1.05 Release |
Added ScreenX and ScreenY functions to TPhysics. Added TColEvent type. | |
Added CollideAdvBody, CollideZone and CollideBounds methods to TAdvBody. | |
History | 1.04 Release |
Added HOLE style, and the methods Turn, OverrideCollision, SetImage and Draw to TZone. | |
Added MouseX, MouseY, DrawImage, SetDrawZoom and SetDrawCoords to TPhysics. | |
History | 1.03 Release |
Added TAdvBody type. Added procedural functions. Added IsFrozen method to TMass. | |
Added SetColGroup and GetColGroup to TZone. | |
History | 1.02 Release |
Added TMass methods GetPosition, GetX, GetY, GetVX, GetVY and GetMass. Fixed TConstraint Method GetStiffness. | |
History | 1.01 Release |
Added shifted grid occlusion | |
History | 1.00 Release |
First release. |