Skip to main content

sm.body

Associated object type: Body

A Body is a collection of Shapes that are attached together.
Multiple bodies can be attached together using Joints such as the bearing.

Functions

createBody

local body = sm.body.createBody(position, rotation, isDynamic)

Server-Only

Creates a new, empty, Body.

Parameters:

  • position (Vec3): The world position of the body.
  • rotation (Quat, optional): The rotation of the body. Defaults to identity.
  • isDynamic (boolean, optional): Whether the body is dynamic or static. Defaults to true.

Returns:

  • body (Body): The created body.

getAllBodies

local bodies = sm.body.getAllBodies()

Server-Only

Returns an array of all Bodies in the world.

Returns:

  • bodies (table): The array of bodies.

getCreationsFromBodies

local creations = sm.body.getCreationsFromBodies(bodies)

Returns an array of arrays containing bodies grouped by creation.

A creation includes all bodies connected by Joints, etc.

Parameters:

  • bodies (table): The array of bodies to get the creations of.

Returns:

  • creations (table): The array of arrays of bodies, grouped by creation.