Moai SDK  2.0
MOAIBox2DBody Class Reference
+ Inheritance diagram for MOAIBox2DBody:

Function List

addChain
 
addCircle
 
addEdges
 
addPolygon
 
addRect
 
applyAngularImpulse
 
applyForce
 
applyLinearImpulse
 
applyTorque
 
destroy
 
getAngle
 
getAngularVelocity
 
getContactList
 
getInertia
 
getGravityScale
 
getLinearVelocity
 
getLocalCenter
 
getMass
 
getPosition
 
getWorldCenter
 
isActive
 
isAwake
 
isBullet
 
isFixedRotation
 
resetMassData
 
setActive
 
setAngularDamping
 
setAngularVelocity
 
setAwake
 
setBullet
 
setFixedRotation
 
setGravityScale
 
setLinearDamping
 
setLinearVelocity
 
setMassData
 
setTransform
 
setType
 
- Function List inherited from MOAINode
clearAttrLink
 
clearNodeLink
 
forceUpdate
 
getAttr
 
getAttrLink
 
getNodeState
 
moveAttr
 
scheduleUpdate
 
seekAttr
 
setAttrLink
 
setAttr
 
setNodeLink
 
- Function List inherited from MOAIInstanceEventSource
getListener
 
setListener
 

Additional Inherited Members

- Function List inherited from MOAITransformBase
getWorldDir
 
getWorldLoc
 
getWorldRot
 
getWorldScl
 
getWorldXAxis
 
getWorldYAxis
 
getWorldZAxis
 
getWorldXNormal
 
getWorldYNormal
 
getWorldZNormal
 
modelToWorld
 
setParent
 
worldToModel
 

Detailed Description

Constants
MOAIBox2DBody.DYNAMIC
MOAIBox2DBody.KINEMATIC
MOAIBox2DBody.STATIC

Function Documentation

addChain

Create and add a set of collision edges to the body.


function addChain ( MOAIBox2DBody self, table verts [, boolean closeChain ] )

Parameters
MOAIBox2DBodyself
tableverts Array containing vertex coordinate components ( t[1] = x0, t[2] = y0, t[3] = x1, t[4] = y1... )
booleancloseChain Optional. Default value is false.
Returns
MOAIBox2DFixture fixture
addCircle

Create and add circle fixture to the body.


function addCircle ( MOAIBox2DBody self, number x, number y, number radius )

Parameters
MOAIBox2DBodyself
numberx in units, world coordinates, converted to meters
numbery in units, world coordinates, converted to meters
numberradius in units, converted to meters
Returns
MOAIBox2DFixture fixture
addEdges

Create and add a polygon fixture to the body.


function addEdges ( MOAIBox2DBody self, table verts )

Parameters
MOAIBox2DBodyself
tableverts Array containing vertex coordinate components in units, world coordinates, converted to meters ( t[1] = x0, t[2] = y0, t[3] = x1, t[4] = y1... )
Returns
table fixtures
addPolygon

Create and add a polygon fixture to the body.


function addPolygon ( MOAIBox2DBody self, table verts )

Parameters
MOAIBox2DBodyself
tableverts Array containing vertex coordinate components in units, world coordinates, converted to meters. ( t[1] = x0, t[2] = y0, t[3] = x1, t[4] = y1... )
Returns
MOAIBox2DFixture fixture
addRect

Create and add a rect fixture to the body.


function addRect ( MOAIBox2DBody self, number xMin, number yMin, number xMax, number yMax, number angle )

Parameters
MOAIBox2DBodyself
numberxMin in units, world coordinates, converted to meters
numberyMin in units, world coordinates, converted to meters
numberxMax in units, world coordinates, converted to meters
numberyMax in units, world coordinates, converted to meters
numberangle
Returns
MOAIBox2DFixture fixture
applyAngularImpulse

See Box2D documentation.


function applyAngularImpulse ( MOAIBox2DBody self, number angularImpulse [, boolean wake ] )

Parameters
MOAIBox2DBodyself
numberangularImpulse in kg * units / s, converted to kg * m / s
booleanwake Optional. wake this body. Default is true
Returns
nil
applyForce

See Box2D documentation.


function applyForce ( MOAIBox2DBody self, number forceX, number forceY [, number pointX, number pointY, boolean wake ] )

Parameters
MOAIBox2DBodyself
numberforceX in kg * units / s^2, converted to N [kg * m / s^2]
numberforceY in kg * units / s^2, converted to N [kg * m / s^2]
numberpointX Optional. in units, world coordinates, converted to meters
numberpointY Optional. in units, world coordinates, converted to meters
booleanwake Optional. wake this body. Default is true
Returns
nil
applyLinearImpulse

See Box2D documentation.


function applyLinearImpulse ( MOAIBox2DBody self, number impulseX, number impulseY [, number pointX, number pointY, boolean wake ] )

Parameters
MOAIBox2DBodyself
numberimpulseX in kg * units / s, converted to kg * m / s
numberimpulseY in kg * units / s, converted to kg * m / s
numberpointX Optional. in units, world coordinates, converted to meters
numberpointY Optional. in units, world coordinates, converted to meters
booleanwake Optional. wake this body. Default is true
Returns
nil
applyTorque

See Box2D documentation.


function applyTorque ( MOAIBox2DBody self [, number torque, boolean wake ] )

Parameters
MOAIBox2DBodyself
numbertorque Optional. in (kg * units / s^2) * units, converted to N-m. Default value is 0.
booleanwake Optional. wake this body. Default is true
Returns
nil
destroy

Schedule body for destruction.


function destroy ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
nil
getAngle

See Box2D documentation.


function getAngle ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
number angle
getAngularVelocity

See Box2D documentation.


function getAngularVelocity ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
number omega
getContactList

Returns list of MOAIBox2DBody that are in contact with this body.


function getContactList ( MOAIBox2DBody self, boolean touching )

Parameters
MOAIBox2DBodyself
booleantouching
Returns
...
getGravityScale

See Box2D documentation.


function getGravityScale ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
number gravityScale
getInertia

See Box2D documentation.


function getInertia ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
number inertia
getLinearVelocity

See Box2D documentation.


function getLinearVelocity ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
number velocityX, number velocityY
getLocalCenter

See Box2D documentation.


function getLocalCenter ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
number centerX, number centerY
getMass

See Box2D documentation.


function getMass ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
number mass
getPosition

See Box2D documentation.


function getPosition ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
number positionX, number positionY
getWorldCenter

See Box2D documentation.


function getWorldCenter ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
number worldX, number worldY
isActive

See Box2D documentation.


function isActive ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
boolean isActive
isAwake

See Box2D documentation.


function isAwake ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
boolean isAwake
isBullet

See Box2D documentation.


function isBullet ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
boolean isBullet
isFixedRotation

See Box2D documentation.


function isFixedRotation ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
boolean isFixedRotation
resetMassData

See Box2D documentation.


function resetMassData ( MOAIBox2DBody self )

Parameters
MOAIBox2DBodyself
Returns
nil
setActive

See Box2D documentation.


function setActive ( MOAIBox2DBody self [, boolean active ] )

Parameters
MOAIBox2DBodyself
booleanactive Optional. Default value is false.
Returns
nil
setAngularDamping

See Box2D documentation.


function setAngularDamping ( MOAIBox2DBody self, number damping )

Parameters
MOAIBox2DBodyself
numberdamping
Returns
nil
setAngularVelocity

See Box2D documentation.


function setAngularVelocity ( MOAIBox2DBody self [, number omega ] )

Parameters
MOAIBox2DBodyself
numberomega Optional. Angular velocity in degrees/s, converted to radians/s. Default value is 0.
Returns
nil
setAwake

See Box2D documentation.


function setAwake ( MOAIBox2DBody self [, boolean awake ] )

Parameters
MOAIBox2DBodyself
booleanawake Optional. Default value is true.
Returns
nil
setBullet

See Box2D documentation.


function setBullet ( MOAIBox2DBody self [, boolean bullet ] )

Parameters
MOAIBox2DBodyself
booleanbullet Optional. Default value is true.
Returns
nil
setFixedRotation

See Box2D documentation.


function setFixedRotation ( MOAIBox2DBody self [, boolean fixedRotation ] )

Parameters
MOAIBox2DBodyself
booleanfixedRotation Optional. Default value is true.
Returns
nil
setGravityScale

See Box2D documentation.


function setGravityScale ( MOAIBox2DBody self [, number gravityScale. ] )

Parameters
MOAIBox2DBodyself
numbergravityScale. Optional.
Returns
nil
setLinearDamping

See Box2D documentation.


function setLinearDamping ( MOAIBox2DBody self [, number damping ] )

Parameters
MOAIBox2DBodyself
numberdamping Optional.
Returns
nil
setLinearVelocity

See Box2D documentation.


function setLinearVelocity ( MOAIBox2DBody self [, number velocityX, number velocityY ] )

Parameters
MOAIBox2DBodyself
numbervelocityX Optional. in unit/s, converted to m/s. Default is 0.
numbervelocityY Optional. in unit/s, converted to m/s. Default is 0.
Returns
nil
setMassData

See Box2D documentation.


function setMassData ( MOAIBox2DBody self, number mass [, number I, number centerX, number centerY ] )

Parameters
MOAIBox2DBodyself
numbermass in kg.
numberI Optional. in kg*units^2, converted to kg * m^2. Default is previous value for I.
numbercenterX Optional. in units, local coordinates, converted to meters. Default is previous value for centerX.
numbercenterY Optional. in units, local coordinates, converted to meters. Default is previous value for centerY.
Returns
nil
setTransform

See Box2D documentation.


function setTransform ( MOAIBox2DBody self [, number positionX, number positionY, number angle ] )

Parameters
MOAIBox2DBodyself
numberpositionX Optional. in units, world coordinates, converted to meters. Default is 0.
numberpositionY Optional. in units, world coordinates, converted to meters. Default is 0.
numberangle Optional. In degrees, converted to radians. Default is 0.
Returns
nil
setType

See Box2D documentation.


function setType ( MOAIBox2DBody self, number type )

Parameters
MOAIBox2DBodyself
numbertype One of MOAIBox2DBody.DYNAMIC, MOAIBox2DBody.KINEMATIC, MOAIBox2DBody.STATIC
Returns
nil