http://www.oxeyegames.com/wiki/index.php?title=AddBoxShape&feed=atom&action=historyAddBoxShape - Revision history2024-03-29T01:02:53ZRevision history for this page on the wikiMediaWiki 1.16.0http://www.oxeyegames.com/wiki/index.php?title=AddBoxShape&diff=407&oldid=prevJeb: Created page with '{{PhysicsMethod| physics:addBoxShape(entityId, shapeDefinition) | Adds a box shape to an entity's body. | {{MethodParam|entityId|An integer|The entity's body identifier, which is...'2010-02-07T12:27:03Z<p>Created page with '{{PhysicsMethod| physics:addBoxShape(entityId, shapeDefinition) | Adds a box shape to an entity's body. | {{MethodParam|entityId|An integer|The entity's body identifier, which is...'</p>
<p><b>New page</b></p><div>{{PhysicsMethod|<br />
physics:addBoxShape(entityId, shapeDefinition)<br />
|<br />
Adds a box shape to an entity's body.<br />
|<br />
{{MethodParam|entityId|An integer|The entity's body identifier, which is returned from the [[createEntity]] method.}}<br />
{{MethodParam|bodyDefinition|A table|The body definition table, see below.}}<br />
|<br />
Returns true if the shape was added successfully.<br />
}}<br />
=== Shape Definition Table ===<br />
<br />
The shape definition table holds shape settings. In addition to the box settings, all shapes have the [[Common Shape Settings]] too.<br />
<br />
{| border=2 cellpadding=3 cellspacing=0 style="margin: 0 0 1em 1em; border-collapse: collapse;"<br />
|-<br />
|style="background:#c797d7"| '''Parameter'''<br />
|style="background:#c797d7"| '''Expected Type'''<br />
|style="background:#c797d7"| '''Description'''<br />
|-<br />
{{MethodParam|x|A number|The centrum X coordinate of the box, in relation to the body's X coordinate. Measured in meters. Defaults to 0 (centered on the body).}}<br />
{{MethodParam|y|A number|The centrum Y coordinate of the box, in relation to the body's Y coordinate. Measured in meters. Defaults to 0 (centered on the body).}}<br />
{{MethodParam|width|A number|The width of the box, measured in meters. Defaults to 1.}}<br />
{{MethodParam|height|A number|The height of the box, measured in meters. Defaults to 1.}}<br />
{{MethodParam|angle|A number|The rotation of the box, measured in radians. Note that this is the fixed rotaion of the shape. It can't be changed later, since [[setEntityAngle]] rotates the whole body and not individual shapes. Defaults to 0.}}<br />
|}<br />
<br />
=== Example ===<br />
<pre><br />
<br />
local playerShapeDef = {<br />
x = 0,<br />
x = 0,<br />
width = 32 * physResolution,<br />
height = 64 * physResolution,<br />
density = 1.5,<br />
filterGroup = player.body,<br />
friction = .01,<br />
}<br />
physics:addBoxShape(player.body, playerShapeDef)<br />
<br />
</pre></div>Jeb