sm.body
Associated object type: Body
A body is a collection of shapes that are built together. Bodies can be connected to other bodies using joints such as the bearing.
Functions:
createBody getAllBodies getCreationsFromBodies getLift
sm.body.createBody(position, rotation?, isDynamic?)
Server only
Create a new body
Parameters:
| Type | Name | Description |
| Vec3 | position | The body's world position. |
| Quat | rotation? | The body's world rotation. (Defaults to sm.quat.identity) |
| boolean | isDynamic? | Set true if the body is dynamic or false if the body is static. (Defaults to true) |
Returns:
| Type | Description |
| Body | The created body |
sm.body.getAllBodies(world?)
Returns a table with all the bodies in the world.
Parameters:
| Type | Name | Description |
| World | world? | The world, will default to the script's world. (optional) |
Returns:
| Type | Description |
| table | The table of all bodies. {Body, ...} |
sm.body.getCreationsFromBodies(bodies)
Returns a table of tables, which is an array of tables containing bodies grouped by creation.
A creation includes all bodies connected by joints, etc.
Parameters:
| Type | Name | Description |
| table | bodies | The bodies to find all creation bodies from. {Body, ...} |
Returns:
| Type | Description |
| table | The table array containing tables of all the bodies, grouped by creation. { {Body, ...}, ... } |
sm.body.getLift(body)
Get the lift a body is on.
Parameters:
| Type | Name | Description |
| Body | body | The body. |
Returns:
| Type | Description |
| Lift | The lift the body is on, or nil if the body is not on a lift. |