Moai SDK  1.5 revision 1 (MoaiEdition)
MOAIBox2DWorld Class Reference
Inheritance diagram for MOAIBox2DWorld:
MOAIAction MOAIInstanceEventSource MOAIEventSource

List of all members.

Function List

  addBody
  addDistanceJoint
  addFrictionJoint
  addGearJoint
  addMouseJoint
  addPrismaticJoint
  addPulleyJoint
  addRevoluteJoint
  addRopeJoint
  addWeldJoint
  addWheelJoint
  getAngularSleepTolerance
  getAutoClearForces
  getGravity
  getLinearSleepTolerance
  getTimeToSleep
  setAngularSleepTolerance
  setAutoClearForces
  setDebugDrawEnabled
  setDebugDrawFlags
  setGravity
  setIterations
  setLinearSleepTolerance
  setTimeToSleep
  setUnitsToMeters
  getRayCast

Function Documentation

Create and add a body to the world.


function addBody ( MOAIBox2DWorld self, number type [, number x, number y ] )
Parameters:
self ( MOAIBox2DWorld )
type ( number ) One of MOAIBox2DBody.DYNAMIC, MOAIBox2DBody.KINEMATIC, MOAIBox2DBody.STATIC
x ( number ) Optional. in units, in world coordinates, converted to meters
y ( number ) Optional. in units, in world coordinates, converted to meters
Returns:
joint ( MOAIBox2DBody )

Create and add a joint to the world. See Box2D documentation.


function addDistanceJoint ( MOAIBox2DWorld self, MOAIBox2DBody bodyA, MOAIBox2DBody bodyB, number anchorA_X, number anchorA_Y, number anchorB_X, number anchorB_Y [, number frequencyHz, number dampingRatio, boolean collideConnected ] )
Parameters:
self ( MOAIBox2DWorld )
bodyA ( MOAIBox2DBody )
bodyB ( MOAIBox2DBody )
anchorA_X ( number ) in units, in world coordinates, converted to meters
anchorA_Y ( number ) in units, in world coordinates, converted to meters
anchorB_X ( number ) in units, in world coordinates, converted to meters
anchorB_Y ( number ) in units, in world coordinates, converted to meters
frequencyHz ( number ) Optional. in Hz. Default value determined by Box2D
dampingRatio ( number ) Optional. Default value determined by Box2D
collideConnected ( boolean ) Optional. Default value is false
Returns:
joint ( MOAIBox2DJoint )

Create and add a joint to the world. See Box2D documentation.


function addFrictionJoint ( MOAIBox2DWorld self, MOAIBox2DBody bodyA, MOAIBox2DBody bodyB, number anchorX, number anchorY [, number maxForce, number maxTorque ] )
Parameters:
self ( MOAIBox2DWorld )
bodyA ( MOAIBox2DBody )
bodyB ( MOAIBox2DBody )
anchorX ( number ) in units, in world coordinates, converted to meters
anchorY ( number ) in units, in world coordinates, converted to meters
maxForce ( number ) Optional. in kg * units / s^2, converted to N [kg * m / s^2]. Default value determined by Box2D
maxTorque ( number ) Optional. in kg * units / s^2 * units, converted to N-m [kg * m / s^2 * m]. Default value determined by Box2D
Returns:
joint ( MOAIBox2DJoint )

Create and add a joint to the world. See Box2D documentation.


function addGearJoint ( MOAIBox2DWorld self, MOAIBox2DJoint jointA, MOAIBox2DJoint jointB, number ratio )
Parameters:
self ( MOAIBox2DWorld )
jointA ( MOAIBox2DJoint )
jointB ( MOAIBox2DJoint )
ratio ( number )
Returns:
joint ( MOAIBox2DJoint )

Create and add a joint to the world. See Box2D documentation.


function addMouseJoint ( MOAIBox2DWorld self, MOAIBox2DBody bodyA, MOAIBox2DBody bodyB, number targetX, number targetY, number maxForce [, number frequencyHz, number dampingRatio ] )
Parameters:
self ( MOAIBox2DWorld )
bodyA ( MOAIBox2DBody )
bodyB ( MOAIBox2DBody )
targetX ( number ) in units, in world coordinates, converted to meters
targetY ( number ) in units, in world coordinates, converted to meters
maxForce ( number ) in kg * units / s^2, converted to N [kg * m / s^2].
frequencyHz ( number ) Optional. in Hz. Default value determined by Box2D
dampingRatio ( number ) Optional. Default value determined by Box2D
Returns:
joint ( MOAIBox2DJoint )

Create and add a joint to the world. See Box2D documentation.


function addPrismaticJoint ( MOAIBox2DWorld self, MOAIBox2DBody bodyA, MOAIBox2DBody bodyB, number anchorA, number anchorB, number axisA, number axisB )
Parameters:
self ( MOAIBox2DWorld )
bodyA ( MOAIBox2DBody )
bodyB ( MOAIBox2DBody )
anchorA ( number ) in units, in world coordinates, converted to meters
anchorB ( number ) in units, in world coordinates, converted to meters
axisA ( number ) translation axis vector X component (no units)
axisB ( number ) translation axis vector Y component (no units)
Returns:
joint ( MOAIBox2DJoint )

Create and add a joint to the world. See Box2D documentation.


function addPulleyJoint ( MOAIBox2DWorld self, MOAIBox2DBody bodyA, MOAIBox2DBody bodyB, number groundAnchorA_X, number groundAnchorA_Y, number groundAnchorB_X, number groundAnchorB_Y, number anchorA_X, number anchorA_Y, number anchorB_X, number anchorB_Y, number ratio, number maxLengthA, number maxLengthB )
Parameters:
self ( MOAIBox2DWorld )
bodyA ( MOAIBox2DBody )
bodyB ( MOAIBox2DBody )
groundAnchorA_X ( number ) in units, in world coordinates, converted to meters
groundAnchorA_Y ( number ) in units, in world coordinates, converted to meters
groundAnchorB_X ( number ) in units, in world coordinates, converted to meters
groundAnchorB_Y ( number ) in units, in world coordinates, converted to meters
anchorA_X ( number ) in units, in world coordinates, converted to meters
anchorA_Y ( number ) in units, in world coordinates, converted to meters
anchorB_X ( number ) in units, in world coordinates, converted to meters
anchorB_Y ( number ) in units, in world coordinates, converted to meters
ratio ( number )
maxLengthA ( number ) in units, converted to meters
maxLengthB ( number ) in units, converted to meters
Returns:
joint ( MOAIBox2DJoint )

Create and add a joint to the world. See Box2D documentation.


function addRevoluteJoint ( MOAIBox2DWorld self, MOAIBox2DBody bodyA, MOAIBox2DBody bodyB, number anchorX, number anchorY )
Parameters:
self ( MOAIBox2DWorld )
bodyA ( MOAIBox2DBody )
bodyB ( MOAIBox2DBody )
anchorX ( number ) in units, in world coordinates, converted to meters
anchorY ( number ) in units, in world coordinates, converted to meters
Returns:
joint ( MOAIBox2DJoint )

Create and add a rope joint to the world. See Box2D documentation.


function addRopeJoint ( MOAIBox2DWorld self, MOAIBox2DBody bodyA, MOAIBox2DBody bodyB, number maxLength [, number anchorAX, number anchorAY, number anchorBX, number anchorBY, boolean collideConnected ] )
Parameters:
self ( MOAIBox2DWorld )
bodyA ( MOAIBox2DBody )
bodyB ( MOAIBox2DBody )
maxLength ( number ) in units, converted to meters
anchorAX ( number ) Optional. in units, in world coordinates, converted to meters
anchorAY ( number ) Optional. in units, in world coordinates, converted to meters
anchorBX ( number ) Optional. in units, in world coordinates, converted to meters
anchorBY ( number ) Optional. in units, in world coordinates, converted to meters
collideConnected ( boolean ) Optional. Default value is false
Returns:
joint ( MOAIBox2DJoint )

Create and add a joint to the world. See Box2D documentation.


function addWeldJoint ( MOAIBox2DWorld self, MOAIBox2DBody bodyA, MOAIBox2DBody bodyB, number anchorX, number anchorY )
Parameters:
self ( MOAIBox2DWorld )
bodyA ( MOAIBox2DBody )
bodyB ( MOAIBox2DBody )
anchorX ( number ) in units, in world coordinates, converted to meters
anchorY ( number ) in units, in world coordinates, converted to meters
Returns:
joint ( MOAIBox2DJoint )

Create and add a joint to the world. See Box2D documentation.


function addWheelJoint ( MOAIBox2DWorld self, MOAIBox2DBody bodyA, MOAIBox2DBody bodyB, number anchorX, number anchorY, number axisX, number axisY )
Parameters:
self ( MOAIBox2DWorld )
bodyA ( MOAIBox2DBody )
bodyB ( MOAIBox2DBody )
anchorX ( number ) in units, in world coordinates, converted to meters
anchorY ( number ) in units, in world coordinates, converted to meters
axisX ( number ) translation axis vector X component (no units)
axisY ( number ) translation axis vector Y component (no units)
Returns:
joint ( MOAIBox2DJoint )

See Box2D documentation.


function getAngularSleepTolerance ( MOAIBox2DWorld self )
Parameters:
self ( MOAIBox2DWorld )
Returns:
angularSleepTolerance ( number )

See Box2D documentation.


function getAutoClearForces ( MOAIBox2DWorld self )
Parameters:
self ( MOAIBox2DWorld )
Returns:
autoClearForces ( boolean )

See Box2D documentation.


function getGravity ( MOAIBox2DWorld self )
Parameters:
self ( MOAIBox2DWorld )
Returns:
gravityX ( number ), gravityY ( number )

See Box2D documentation.


function getLinearSleepTolerance ( MOAIBox2DWorld self )
Parameters:
self ( MOAIBox2DWorld )
Returns:
linearSleepTolerance ( number )

return RayCast 1st point hit


function getRayCast ( MOAIBox2DWorld self, number p1x, number p1y, number p2x, number p2y )
Parameters:
self ( MOAIBox2DWorld )
p1x ( number )
p1y ( number )
p2x ( number )
p2y ( number )
Returns:
true ( bool ), fixture ( MOAIBox2DFixture ), hitpoint.x ( number ), hitpoint.y ( number )

See Box2D documentation.


function getTimeToSleep ( MOAIBox2DWorld self )
Parameters:
self ( MOAIBox2DWorld )
Returns:
timeToSleep ( number )

See Box2D documentation.


function setAngularSleepTolerance ( MOAIBox2DWorld self [, number angularSleepTolerance ] )
Parameters:
self ( MOAIBox2DWorld )
angularSleepTolerance ( number ) Optional. in degrees/s, converted to radians/s. Default value is 0.0f.
Returns:
nil

See Box2D documentation.


function setAutoClearForces ( MOAIBox2DWorld self [, boolean autoClearForces ] )
Parameters:
self ( MOAIBox2DWorld )
autoClearForces ( boolean ) Optional. Default value is 'true'
Returns:
nil

enable/disable debug drawing.


function setDebugDrawEnabled ( MOAIBox2DWorld self, boolean enable )
Parameters:
self ( MOAIBox2DWorld )
enable ( boolean )
Returns:
nil

Sets mask for debug drawing.


function setDebugDrawFlags ( MOAIBox2DWorld self [, number flags ] )
Parameters:
self ( MOAIBox2DWorld )
flags ( number ) Optional. One of MOAIBox2DWorld.DEBUG_DRAW_SHAPES, MOAIBox2DWorld.DEBUG_DRAW_JOINTS, MOAIBox2DWorld.DEBUG_DRAW_BOUNDS, MOAIBox2DWorld.DEBUG_DRAW_PAIRS, MOAIBox2DWorld.DEBUG_DRAW_CENTERS. Default value is MOAIBox2DWorld.DEBUG_DRAW_DEFAULT.
Returns:
nil

See Box2D documentation.


function setGravity ( MOAIBox2DWorld self [, number gravityX, number gravityY ] )
Parameters:
self ( MOAIBox2DWorld )
gravityX ( number ) Optional. in units/s^2, converted to m/s^2. Default value is 0.
gravityY ( number ) Optional. in units/s^2, converted to m/s^2. Default value is 0.
Returns:
nil

See Box2D documentation.


function setIterations ( MOAIBox2DWorld self [, number velocityIteratons, number positionIterations ] )
Parameters:
self ( MOAIBox2DWorld )
velocityIteratons ( number ) Optional. Default value is current value of velocity iterations.
positionIterations ( number ) Optional. Default value is current value of positions iterations.
Returns:
nil

See Box2D documentation.


function setLinearSleepTolerance ( MOAIBox2DWorld self [, number linearSleepTolerance ] )
Parameters:
self ( MOAIBox2DWorld )
linearSleepTolerance ( number ) Optional. in units/s, converted to m/s. Default value is 0.0f.
Returns:
nil

See Box2D documentation.


function setTimeToSleep ( MOAIBox2DWorld self [, number timeToSleep ] )
Parameters:
self ( MOAIBox2DWorld )
timeToSleep ( number ) Optional. Default value is 0.0f.
Returns:
nil

Sets a scale factor for converting game world units to Box2D meters.


function setUnitsToMeters ( MOAIBox2DWorld self [, number unitsToMeters ] )
Parameters:
self ( MOAIBox2DWorld )
unitsToMeters ( number ) Optional. Default value is 1.
Returns:
nil