Moai SDK  1.5 revision 1 (MoaiEdition)
MOAIBox2DBody Class Reference
Inheritance diagram for MOAIBox2DBody:
MOAITransformBase MOAINode MOAIInstanceEventSource MOAIEventSource

List of all members.

Function List

  addChain
  addCircle
  addEdges
  addPolygon
  addRect
  applyAngularImpulse
  applyForce
  applyLinearImpulse
  applyTorque
  destroy
  getAngle
  getAngularVelocity
  getInertia
  getLinearVelocity
  getLocalCenter
  getMass
  getPosition
  getWorldCenter
  isActive
  isAwake
  isBullet
  isFixedRotation
  resetMassData
  setActive
  setAngularDamping
  setAngularVelocity
  setAwake
  setBullet
  setFixedRotation
  setLinearDamping
  setLinearVelocity
  setMassData
  setTransform
  setType

Function Documentation

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


function addChain ( MOAIBox2DBody self, table verts [, boolean closeChain ] )
Parameters:
self ( MOAIBox2DBody )
verts ( table ) Array containing vertex coordinate components ( t[1] = x0, t[2] = y0, t[3] = x1, t[4] = y1... )
closeChain ( boolean ) Optional. Default value is false.
Returns:
fixture ( MOAIBox2DFixture )

Create and add circle fixture to the body.


function addCircle ( MOAIBox2DBody self, number x, number y, number radius )
Parameters:
self ( MOAIBox2DBody )
x ( number ) in units, world coordinates, converted to meters
y ( number ) in units, world coordinates, converted to meters
radius ( number ) in units, converted to meters
Returns:
fixture ( MOAIBox2DFixture )

Create and add a polygon fixture to the body.


function addEdges ( MOAIBox2DBody self, table verts )
Parameters:
self ( MOAIBox2DBody )
verts ( table ) 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:
fixtures ( table )

Create and add a polygon fixture to the body.


function addPolygon ( MOAIBox2DBody self, table verts )
Parameters:
self ( MOAIBox2DBody )
verts ( table ) 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:
fixture ( MOAIBox2DFixture )

Create and add a rect fixture to the body.


function addRect ( MOAIBox2DBody self, number xMin, number yMin, number xMax, number yMax, number angle )
Parameters:
self ( MOAIBox2DBody )
xMin ( number ) in units, world coordinates, converted to meters
yMin ( number ) in units, world coordinates, converted to meters
xMax ( number ) in units, world coordinates, converted to meters
yMax ( number ) in units, world coordinates, converted to meters
angle ( number )
Returns:
fixture ( MOAIBox2DFixture )

See Box2D documentation.


function applyAngularImpulse ( MOAIBox2DBody self, number angularImpulse )
Parameters:
self ( MOAIBox2DBody )
angularImpulse ( number ) in kg * units / s, converted to kg * m / s
Returns:
nil

See Box2D documentation.


function applyForce ( MOAIBox2DBody self, number forceX, number forceY [, number pointX, number pointY ] )
Parameters:
self ( MOAIBox2DBody )
forceX ( number ) in kg * units / s^2, converted to N [kg * m / s^2]
forceY ( number ) in kg * units / s^2, converted to N [kg * m / s^2]
pointX ( number ) Optional. in units, world coordinates, converted to meters
pointY ( number ) Optional. in units, world coordinates, converted to meters
Returns:
nil

See Box2D documentation.


function applyLinearImpulse ( MOAIBox2DBody self, number impulseX, number impulseY [, number pointX, number pointY ] )
Parameters:
self ( MOAIBox2DBody )
impulseX ( number ) in kg * units / s, converted to kg * m / s
impulseY ( number ) in kg * units / s, converted to kg * m / s
pointX ( number ) Optional. in units, world coordinates, converted to meters
pointY ( number ) Optional. in units, world coordinates, converted to meters
Returns:
nil

See Box2D documentation.


function applyTorque ( MOAIBox2DBody self [, number torque ] )
Parameters:
self ( MOAIBox2DBody )
torque ( number ) Optional. in (kg * units / s^2) * units, converted to N-m. Default value is 0.
Returns:
nil

Schedule body for destruction.


function destroy ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
nil

See Box2D documentation.


function getAngle ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
angle ( number )

See Box2D documentation.


function getAngularVelocity ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
omega ( number )

See Box2D documentation.


function getInertia ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
inertia ( number )

See Box2D documentation.


function getLinearVelocity ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
velocityX ( number ), velocityY ( number )

See Box2D documentation.


function getLocalCenter ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
centerX ( number ), centerY ( number )

See Box2D documentation.


function getMass ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
mass ( number )

See Box2D documentation.


function getPosition ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
positionX ( number ), positionY ( number )

See Box2D documentation.


function getWorldCenter ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
worldX ( number ), worldY ( number )

See Box2D documentation.


function isActive ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
isActive ( boolean )

See Box2D documentation.


function isAwake ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
isAwake ( boolean )

See Box2D documentation.


function isBullet ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
isBullet ( boolean )

See Box2D documentation.


function isFixedRotation ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
isFixedRotation ( boolean )

See Box2D documentation.


function resetMassData ( MOAIBox2DBody self )
Parameters:
self ( MOAIBox2DBody )
Returns:
nil

See Box2D documentation.


function setActive ( MOAIBox2DBody self [, boolean active ] )
Parameters:
self ( MOAIBox2DBody )
active ( boolean ) Optional. Default value is false.
Returns:
nil

See Box2D documentation.


function setAngularDamping ( MOAIBox2DBody self, number damping )
Parameters:
self ( MOAIBox2DBody )
damping ( number )
Returns:
nil

See Box2D documentation.


function setAngularVelocity ( MOAIBox2DBody self [, number omega ] )
Parameters:
self ( MOAIBox2DBody )
omega ( number ) Optional. Angular velocity in degrees/s, converted to radians/s. Default value is 0.
Returns:
nil

See Box2D documentation.


function setAwake ( MOAIBox2DBody self [, boolean awake ] )
Parameters:
self ( MOAIBox2DBody )
awake ( boolean ) Optional. Default value is true.
Returns:
nil

See Box2D documentation.


function setBullet ( MOAIBox2DBody self [, boolean bullet ] )
Parameters:
self ( MOAIBox2DBody )
bullet ( boolean ) Optional. Default value is true.
Returns:
nil

See Box2D documentation.


function setFixedRotation ( MOAIBox2DBody self [, boolean fixedRotation ] )
Parameters:
self ( MOAIBox2DBody )
fixedRotation ( boolean ) Optional. Default value is true.
Returns:
nil

See Box2D documentation.


function setLinearDamping ( MOAIBox2DBody self [, number damping ] )
Parameters:
self ( MOAIBox2DBody )
damping ( number ) Optional.
Returns:
nil

See Box2D documentation.


function setLinearVelocity ( MOAIBox2DBody self [, number velocityX, number velocityY ] )
Parameters:
self ( MOAIBox2DBody )
velocityX ( number ) Optional. in unit/s, converted to m/s. Default is 0.
velocityY ( number ) Optional. in unit/s, converted to m/s. Default is 0.
Returns:
nil

See Box2D documentation.


function setMassData ( MOAIBox2DBody self, number mass [, number I, number centerX, number centerY ] )
Parameters:
self ( MOAIBox2DBody )
mass ( number ) in kg.
I ( number ) Optional. in kg*units^2, converted to kg * m^2. Default is previous value for I.
centerX ( number ) Optional. in units, local coordinates, converted to meters. Default is previous value for centerX.
centerY ( number ) Optional. in units, local coordinates, converted to meters. Default is previous value for centerY.
Returns:
nil

See Box2D documentation.


function setTransform ( MOAIBox2DBody self [, number positionX, number positionY, number angle ] )
Parameters:
self ( MOAIBox2DBody )
positionX ( number ) Optional. in units, world coordinates, converted to meters. Default is 0.
positionY ( number ) Optional. in units, world coordinates, converted to meters. Default is 0.
angle ( number ) Optional. In degrees, converted to radians. Default is 0.
Returns:
nil

See Box2D documentation.


function setType ( MOAIBox2DBody self, number type )
Parameters:
self ( MOAIBox2DBody )
type ( number ) One of MOAIBox2DBody.DYNAMIC, MOAIBox2DBody.KINEMATIC, MOAIBox2DBody.STATIC
Returns:
nil