Body
A userdata object representing a body in the game.
Values:
-
angularVelocity[ Vec3 ]Get: Returns the angular velocity of a body.
-
Get: Check if a body is buildableSet: (Server-Only) Controls whether a body is buildable
-
centerOfMassPosition[ Vec3 ]Get: Returns the center of mass world position of a body.
-
Get: Check if a body is connectableSet: (Server-Only) Controls whether a body is connectable
-
convertableToDynamic[ boolean ]Get: Check if a body is convertible to dynamic formSet: (Server-Only) Controls whether a body is convertible to dynamic form
-
Get: Check if a body is destructable.Set: (Server-Only) Controls whether a body is destructable
-
Get: Check if a body is erasable.Set: (Server-Only) Controls whether a body is erasable
-
Get: Returns the id of a body.
-
Get: Check if a body is liftableSet: (Server-Only) Controls whether a body is liftable
-
Get: Returns the mass of a body.
-
Get: Check if a body is paintableSet: (Server-Only) Controls whether a body is non paintable
-
Get: Check if a body is interactableSet: (Server-Only) Controls whether a body is interactable
-
velocity[ Vec3 ]Get: Returns the linear velocity of a body.
-
worldPosition[ Vec3 ]Get: Returns the world position of a body.
-
worldRotation[ Quat ]Get: Returns the world rotation of a body.
Operations:
| Operation | Returns | Description |
|---|---|---|
Body == Body |
boolean | Checks if two instances of Body refer to the same Body. |
Server + Client
getAngularVelocity
body:getAngularVelocity( )
Returns the angular velocity of a body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The body's angular velocity. |
getCenterOfMassPosition
body:getCenterOfMassPosition( )
Returns the center of mass world position of a body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The body's center of mass world position. |
getCreationBodies
body:getCreationBodies( )
Returns a table of all bodies in a creation.
A creation includes all bodies connected by joints, etc.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| table | An array table of all bodies in a creation. {Body, ...} |
getCreationId
body:getCreationId( )
Returns the local id of the creation
Note: Server and client ids will not match
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| integer | The creation's local id |
getCreationJoints
body:getCreationJoints( )
Returns a table of all joints that are part of a creation.
A creation includes all bodies connected by joints, etc.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| table | The table of joints in a creation. {Joint, ...} |
getCreationShapes
body:getCreationShapes( )
Returns a table of all shapes that are part of a creation.
A creation includes all bodies connected by joints, etc.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| table | The table of shapes in a creation. {Shape, ...} |
getId
body:getId( )
Returns the id of a body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| integer | The body's id. |
getInteractables
body:getInteractables( )
Returns a table of all interactables that are part of a body.
This will not return interactables in neighbouring bodies connected by joints, etc.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| table | The table of interactables in a body. {Interactable, ...} |
getJoints
body:getJoints( )
Returns a table of all joints that are part of a body.
This will not return joints in neighbouring bodies.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| table | The table of joints in a body. {Joint, ...} |
getLocalAabb
body:getLocalAabb( )
Get the local aabb of the body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
getMass
body:getMass( )
Returns the mass of a body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| number | The body's mass. |
getShape
body:getShape( index )
Returns a shape that is part of a body by index.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
index |
integer | The index of the shape. |
Returns:
| Type | Description |
|---|---|
| Shape | The shape at the specified index, or nil if the index is out of range. |
getShapeCount
body:getShapeCount( )
Returns the number of shapes in a body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| integer | The number of shapes in the body. |
getShapes
body:getShapes( )
Returns a table of all shapes that are part of a body.
This will not return shapes in neighbouring bodies connected by joints, etc.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| table | The table of shapes in a body. {Shape, ...} |
getShapesByUuid
body:getShapesByUuid( uuid )
Returns a table of all shapes that are part of a body and have a specified uuid.
This will not return shapes in neighbouring bodies connected by joints, etc.
Parameters:
Returns:
| Type | Description |
|---|---|
| table | The table of shapes in a body. {Shape, ...} |
getVelocity
body:getVelocity( )
Returns the linear velocity of a body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The body's linear velocity. |
getWorld
body:getWorld( )
Returns the world a body exists in.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| World | The world the body exists in. |
getWorldAabb
body:getWorldAabb( )
Get the world aabb of the body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
getWorldPosition
body:getWorldPosition( )
Returns the world position of a body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The body's world position. |
hasChanged
body:hasChanged( tick )
Returns true if the given tick is lower than the tick the body was last changed.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
tick |
integer | The tick. |
Returns:
| Type | Description |
|---|---|
| boolean | Returns true if the body has been changed. |
isBuildable
body:isBuildable( )
Check if a body is buildable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is buildable. |
isConnectable
body:isConnectable( )
Check if a body is connectable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is connectable. |
isConvertibleToDynamic
body:isConvertibleToDynamic( )
Check if a body is convertible to dynamic form
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body can be converted to dynamic. |
isDestructable
body:isDestructable( )
Check if a body is destructable.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is destructable. |
isDynamic
body:isDynamic( )
Check if a body is dynamic
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is dynamic. |
isErasable
body:isErasable( )
Check if a body is erasable.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is erasable. |
isGhost
body:isGhost( )
Check if the body is a ghost body.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Returns true if the body is a ghost body. |
isLiftable
body:isLiftable( )
Check if a body is liftable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is liftable. |
isOnLift
body:isOnLift( )
Check if a body is on a lift
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is on a lift |
isOnVirtualLift
body:isOnVirtualLift( )
Check if a body is on a virtual lift
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is on a lift |
isPaintable
body:isPaintable( )
Check if a body is paintable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is paintable. |
isStatic
body:isStatic( )
Check if a body is static
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is static. |
isUsable
body:isUsable( )
Check if a body is interactable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the body is interactable. |
transformLocalPoint
body:transformLocalPoint( point )
Transforms a point from local space to world space.
Parameters:
Returns:
| Type | Description |
|---|---|
| Vec3 | The point in world space. |
transformPoint
body:transformPoint( point )
Transforms a point from local space to world space.
Parameters:
Returns:
| Type | Description |
|---|---|
| Vec3 | The point in world space. |
transformWorldPoint
body:transformWorldPoint( point )
Transforms a point from world space to local space.
Parameters:
Returns:
| Type | Description |
|---|---|
| Vec3 | The point in local space. |
Server-only
createBlock
body:createBlock( uuid, size, position, forceAccept )
Create a block on body
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The parent body. |
uuid |
Uuid | The uuid of the shape. |
size |
Vec3 | The shape's size. |
position |
Vec3 | The shape's local position. |
forceAccept (optional) |
boolean | Set true to force the body to accept the shape. (Defaults to true) |
Returns:
| Type | Description |
|---|---|
| Shape | The created block |
createPart
body:createPart( uuid, position, z-axis, x-axis, forceAccept )
Create a part on body
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The parent body. |
uuid |
Uuid | The uuid of the shape. |
position |
Vec3 | The shape's local position. |
z-axis |
Vec3 | The shape's local z direction. |
x-axis |
Vec3 | The shape's local x direction. |
forceAccept (optional) |
boolean | Set true to force the body to accept the shape. (Defaults to true) |
Returns:
| Type | Description |
|---|---|
| Shape | The created part |
createWedge
body:createWedge( uuid, size, position, z-axis, x-axis, forceAccept )
Creates a wedge attached to a body. The wedge is oriented with one
cathetus along the Y-axis and the other along the Z-axis, forming a right angle. The wedge's
rotation is controlled by z-axis and x-axis parameters, similar to standard part rotation.
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The parent body. |
uuid |
Uuid | The uuid of the shape. |
size |
Vec3 | The shape's size. |
position |
Vec3 | The shape's local position. |
z-axis |
Vec3 | The shape's local z direction. |
x-axis |
Vec3 | The shape's local x direction. |
forceAccept (optional) |
boolean | Set true to force the body to accept the shape. (Defaults to true) |
destroyCreation
body:destroyCreation( )
Destroys the entire creation connected to this body
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
getAllSeatedCharacter
body:getAllSeatedCharacter( )
Returns a table with all characters seated in this body
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
Returns:
| Type | Description |
|---|---|
| table | The table of all seated characters. {Character, ...} |
setBuildable
body:setBuildable( value )
Controls whether a body is buildable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
value |
boolean | Whether the body is buildable. |
setConnectable
body:setConnectable( value )
Controls whether a body is connectable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
value |
boolean | Whether the body is connectable. |
setConvertibleToDynamic
body:setConvertibleToDynamic( value )
Controls whether a body is convertible to dynamic form
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
value |
boolean | Whether the body is convertible to dynamic form. |
setDestructable
body:setDestructable( value )
Controls whether a body is destructable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
value |
boolean | Whether the body is destructable. |
setErasable
body:setErasable( value )
Controls whether a body is erasable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
value |
boolean | Whether the body is erasable. |
setLiftable
body:setLiftable( value )
Controls whether a body is liftable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
value |
boolean | Whether the body is liftable. |
setPaintable
body:setPaintable( value )
Controls whether a body is non paintable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
value |
boolean | Whether the body is paintable. |
setUsable
body:setUsable( value )
Controls whether a body is interactable
Parameters:
| Name | Type | Description |
|---|---|---|
body |
Body | The body. |
value |
boolean | Whether the body is interactable. |