Moai SDK
1.5 revision 1 (MoaiEdition)
|
Activates a body after it has been put to sleep (physics will now be processed for this body again).
function activate ( MOAICpBody self )
self | ( MOAICpBody ) |
Adds a circle to the body.
function addCircle ( MOAICpBody self, number radius, number x, number y )
self | ( MOAICpBody ) |
radius | ( number ) |
x | ( number ) |
y | ( number ) |
Adds a polygon to the body.
function addPolygon ( MOAICpBody self, table polygon )
self | ( MOAICpBody ) |
polygon | ( table ) |
Adds a rectangle to the body.
function addRect ( MOAICpBody self, number x1, number y1, number x2, number y2 )
self | ( MOAICpBody ) |
x1 | ( number ) |
y1 | ( number ) |
x2 | ( number ) |
y2 | ( number ) |
Adds a segment to the body.
function addSegment ( MOAICpBody self, number x1, number y1, number x2, number y2 [, number radius ] )
self | ( MOAICpBody ) |
x1 | ( number ) |
y1 | ( number ) |
x2 | ( number ) |
y2 | ( number ) |
radius | ( number ) Optional. |
Applies force to the body, taking into account any existing forces being applied.
function applyForce ( MOAICpBody self, number fx, number fy, number rx, number ry )
self | ( MOAICpBody ) |
fx | ( number ) |
fy | ( number ) |
rx | ( number ) |
ry | ( number ) |
Applies impulse to the body, taking into account any existing impulses being applied.
function applyImpulse ( MOAICpBody self, number jx, number jy, number rx, number ry )
self | ( MOAICpBody ) |
jx | ( number ) |
jy | ( number ) |
rx | ( number ) |
ry | ( number ) |
Returns the angle of the body.
function getAngle ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns the angular velocity of the body.
function getAngVel ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns the force of the body.
function getForce ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns the mass of the body.
function getMass ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns the moment of the body.
function getMoment ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns the position of the body.
function getPos ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns the rotation of the body.
function getRot ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns the torque of the body.
function getTorque ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns the velocity of the body.
function getVel ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns whether the body is not yet currently associated with a space.
function isRogue ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns whether the body is currently sleeping.
function isSleeping ( MOAICpBody self )
self | ( MOAICpBody ) |
Returns whether the body is static.
function isStatic ( MOAICpBody self )
self | ( MOAICpBody ) |
Converts the relative position to an absolute position based on position of the object being (0, 0) for the relative position.
function localToWorld ( MOAICpBody self, number rx, number ry )
self | ( MOAICpBody ) |
rx | ( number ) The relative X position. |
ry | ( number ) The relative Y position. |
Creates a new body with the specified mass and moment.
function new ( number m, number i )
m | ( number ) The mass of the new body. |
i | ( number ) The moment of the new body. |
Resets all forces on the body.
function resetForces ( MOAICpBody self )
self | ( MOAICpBody ) |
Sets the angle of the body.
function setAngle ( MOAICpBody self, number angle )
self | ( MOAICpBody ) |
angle | ( number ) The angle of the body. |
Sets the angular velocity of the body.
function setAngVel ( MOAICpBody self, number angvel )
self | ( MOAICpBody ) |
angvel | ( number ) The angular velocity of the body. |
Sets the force on the body.
function setForce ( MOAICpBody self, number forcex, number forcey )
self | ( MOAICpBody ) |
forcex | ( number ) The X force being applied to the body. |
forcey | ( number ) The Y force being applied to the body. |
Sets the mass of the body.
function setMass ( MOAICpBody self, number mass )
self | ( MOAICpBody ) |
mass | ( number ) The mass of the body. |
Sets the moment of the body.
function setMoment ( MOAICpBody self, number moment )
self | ( MOAICpBody ) |
moment | ( number ) The moment of the body. |
Sets the position of the body.
function setPos ( MOAICpBody self, number x, number y )
self | ( MOAICpBody ) |
x | ( number ) The X position of the body. |
y | ( number ) The Y position of the body. |
Sets the removal flag on the body.
function setRemoveFlag ( MOAICpBody self, number flag )
self | ( MOAICpBody ) |
flag | ( number ) The removal flag. |
Sets the torque of the body.
function setTorque ( MOAICpBody self, number torque )
self | ( MOAICpBody ) |
torque | ( number ) The torque of the body. |
Sets the velocity of the body.
function setVel ( MOAICpBody self, number x, number y )
self | ( MOAICpBody ) |
x | ( number ) The horizontal velocity. |
y | ( number ) The vertical velocity. |
Puts the body to sleep (physics will no longer be processed for it until it is activated).
function sleep ( MOAICpBody self )
self | ( MOAICpBody ) |
Forces an object to sleep. Pass in another sleeping body to add the object to the sleeping body's existing group.
function sleepWithGroup ( MOAICpBody self, MOAICpBody group )
self | ( MOAICpBody ) |
group | ( MOAICpBody ) |
Converts the absolute position to a relative position based on position of the object being (0, 0) for the relative position.
function worldToLocal ( MOAICpBody self, number ax, number ay )
self | ( MOAICpBody ) |
ax | ( number ) The absolute X position. |
ay | ( number ) The absolute Y position. |