Skip to main content

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

sm.body.createBody( position, rotation, isDynamic )
Server-Only

Creates a new body.

Arguments:
  • position [ Vec3 ]: The body's world position.
  • rotation [ Quat ]: The body's world rotation (optional).
  • isDynamic [ bool ]: Whether the body is dynamic or static. Defaults to dynamic.

getAllBodies

sm.body.getAllBodies()
Server-Only

Returns a table of all bodies in the world.

Returns:
  • [ table ]: The table of bodies.

getCreationsFromBodies

sm.body.getCreationsFromBodies( bodies )

Returns an array of tables containing bodies grouped by creation.

A creation includes all bodies connected by joints, etc.

Arguments:
  • bodies [ table ]: The bodies to get the creations of.
Return:
  • [ table ]: The table array containing tables of all the bodies, grouped by creation.