Moai SDK  1.5 revision 1 (MoaiEdition)
MOAICpShape Class Reference

Inherits MOAILuaObject, and MOAICpPrim.

List of all members.

Function List

  areaForCircle
  areaForPolygon
  areaForRect
  areaForSegment
  getBody
  getElasticity
  getFriction
  getGroup
  getLayers
  getSurfaceVel
  getType
  inside
  isSensor
  momentForCircle
  momentForPolygon
  momentForRect
  momentForSegment
  setElasticity
  setFriction
  setGroup
  setIsSensor
  setLayers
  setSurfaceVel
  setType

Function Documentation

Returns the area for a ring or circle.


function areaForCircle ( number radius )
Parameters:
radius ( number )
Returns:
area ( number )
Note:

function areaForCircle ( number innerRadius, number outerRadius )
Parameters:
innerRadius ( number )
outerRadius ( number )
Returns:
area ( number )
Note:

Returns the area for a polygon.


function areaForPolygon ( table vertices )
Parameters:
vertices ( table ) Array containing vertex coordinate components ( t[1] = x0, t[2] = y0, t[3] = x1, t[4] = y1... )
Returns:
area ( number )

Returns the area for the specified rectangle.


function areaForRect ( number x1, number y1, number x2, number y2 )
Parameters:
x1 ( number )
y1 ( number )
x2 ( number )
y2 ( number )
Returns:
area ( number )

Returns the area for the specified segment.


function areaForSegment ( number x1, number y1, number x2, number y2, number r )
Parameters:
x1 ( number )
y1 ( number )
x2 ( number )
y2 ( number )
r ( number )
Returns:
area ( number )

Returns the current body for the shape.


function getBody ( MOAICpShape self )
Parameters:
self ( MOAICpShape )
Returns:
body ( MOAICpBody )

Returns the current elasticity.


function getElasticity ( MOAICpShape self )
Parameters:
self ( MOAICpShape )
Returns:
elasticity ( number )

Returns the current friction.


function getFriction ( MOAICpShape self )
Parameters:
self ( MOAICpShape )
Returns:
friction ( number )

Returns the current group ID.


function getGroup ( MOAICpShape self )
Parameters:
self ( MOAICpShape )
Returns:
group ( number )

Returns the current layer ID.


function getLayers ( MOAICpShape self )
Parameters:
self ( MOAICpShape )
Returns:
layer ( number )

Returns the current surface velocity?


function getSurfaceVel ( MOAICpShape self )
Parameters:
self ( MOAICpShape )
Returns:
x ( number ), y ( number )

Returns the current collision type.


function getType ( MOAICpShape self )
Parameters:
self ( MOAICpShape )
Returns:
type ( number )

Returns whether the specified point is inside the shape.


function inside ( MOAICpShape self, number x, number y )
Parameters:
self ( MOAICpShape )
x ( number )
y ( number )
Returns:
inside ( boolean )

Returns whether the current shape is a sensor.


function isSensor ( MOAICpShape self )
Parameters:
self ( MOAICpShape )
Returns:
sensor ( boolean )

Return the moment of inertia for the circle.


function momentForCircle ( number m, number r1, number r2, number ox, number oy )
Parameters:
m ( number )
r1 ( number )
r2 ( number )
ox ( number )
oy ( number )
Returns:
moment ( number )

Returns the moment of intertia for the polygon.


function momentForPolygon ( number m, table polygon )
Parameters:
m ( number )
polygon ( table )
Returns:
moment ( number )

Returns the moment of intertia for the rect.


function momentForRect ( number m, number x1, number y1, number x2, number y2 )
Parameters:
m ( number )
x1 ( number )
y1 ( number )
x2 ( number )
y2 ( number )
Returns:
moment ( number )

Returns the moment of intertia for the segment.


function momentForSegment ( number m, number x1, number y1, number x2, number y2 )
Parameters:
m ( number )
x1 ( number )
y1 ( number )
x2 ( number )
y2 ( number )
Returns:
moment ( number )

Sets the current elasticity.


function setElasticity ( MOAICpShape self, number elasticity )
Parameters:
self ( MOAICpShape )
elasticity ( number ) The elasticity.
Returns:
nil

Sets the current friction.


function setFriction ( MOAICpShape self, number friction )
Parameters:
self ( MOAICpShape )
friction ( number ) The friction.
Returns:
nil

Sets the current group ID.


function setGroup ( MOAICpShape self, number group )
Parameters:
self ( MOAICpShape )
group ( number ) The group ID.
Returns:
nil

Sets whether this shape is a sensor.


function setIsSensor ( MOAICpShape self, boolean sensor )
Parameters:
self ( MOAICpShape )
sensor ( boolean ) Whether this shape is a sensor.
Returns:
nil

Sets the current layer ID.


function setLayers ( MOAICpShape self, number layer )
Parameters:
self ( MOAICpShape )
layer ( number ) The layer ID.
Returns:
nil

Sets the current surface velocity.


function setSurfaceVel ( MOAICpShape self, number x, number y )
Parameters:
self ( MOAICpShape )
x ( number ) The X component of the surface velocity.
y ( number ) The Y component of the surface velocity.
Returns:
nil

Sets the current collision type.


function setType ( MOAICpShape self, number type )
Parameters:
self ( MOAICpShape )
type ( number ) The collision type.
Returns:
nil