sm.creation
A Creation represent a collection of bodies linked together by joints.
Functions:
sm.creation.buildMultiShape(shape, worldPosition, worldRotation, localPosition, localRotation)
Server only
Builds a multi shape
Parameters:
| Type | Name | Description |
|---|---|---|
| Uuid | shape | The uuid of shape to build. |
| Vec3 | worldPosition | World position of shape. |
| Quat | worldRotation | World rotation of shape. |
| Vec3 | localPosition | Local position of shape. |
| Quat | localRotation | Local rotation of shape. |
sm.creation.exportToString(body, exportTransforms?, forceDynamic?)
Server only
Exports creation to blueprint formatted json string.
Parameters:
| Type | Name | Description |
|---|---|---|
| Body | body | Any body in the creation. |
| boolean | exportTransforms? | Export the current world transform of bodies. Defaults to false. |
| boolean | forceDynamic? | Force export to dynamic bodies. Defaults to false. |
Returns:
| Type | Description |
|---|---|
| string | The blueprint json string. |
sm.creation.exportToTable(body, exportTransforms?, forceDynamic?)
Server only
Exports creation to blueprint lua table.
Parameters:
| Type | Name | Description |
|---|---|---|
| Body | body | Any body in the creation. |
| boolean | exportTransforms? | Export the current world transform of bodies. Defaults to false. |
| boolean | forceDynamic? | Force export to dynamic bodies. Defaults to false. |
Returns:
| Type | Description |
|---|---|
| table | The blueprint lua table. |
sm.creation.getBlueprintCost(filePath, bodyId?)
Returns a table with uuid's and quantity. A body can be sent in to remove from blueprint cost.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | filePath | The file path for the blueprint. |
| integer | bodyId? | The id of a body.(Optional) |
Returns:
| Type | Description |
|---|---|
| table | The table of { Uuid, quantity } |
sm.creation.getBlueprintCost(table, bodyId?)
Returns a table with uuid's and quantity. A body can be sent in to remove from blueprint cost.
Parameters:
| Type | Name | Description |
|---|---|---|
| table | table | The lua table for the blueprint. |
| integer | bodyId? | The id of a body.(Optional) |
Returns:
| Type | Description |
|---|---|
| table | The table of { Uuid, quantity } |
sm.creation.importFromFile(world, pathString, worldPosition?, worldRotation?, importTransforms?, indestructible?)
Server only
Imports blueprint json file to world.
Warning:
If the blueprint was not exported with transforms the importer will treat it as if importTransforms was disabled.
Parameters:
| Type | Name | Description |
|---|---|---|
| World | world | The world to import to. |
| string | pathString | The blueprint path. |
| Vec3 | worldPosition? | World position of import. If importTransforms is enabled position is applied to the imported transform. (Defaults to vec3.zero().) |
| Quat | worldRotation? | World rotation of import. If importTransforms is enabled rotation is applied to the imported transform. (Defaults to quat.identity().) |
| boolean | importTransforms? | Import world transforms from bodies. (Defaults to false.) |
| boolean | indestructible? | (DEPRECATED) Ignored, use setDestructable(false) on each body in creation. (Defaults to false) |
Returns:
| Type | Description |
|---|---|
| table | The table {Body, ...} of bodies created from the blueprint. |
sm.creation.importFromString(world, jsonString, worldPosition?, worldRotation?, importTransforms?, forceInactive?)
Server only
Imports blueprint json string to world.
Warning:
If the blueprint was not exported with transforms the importer will treat it as if importTransforms was disabled.
Parameters:
| Type | Name | Description |
|---|---|---|
| World | world | The world to import to. |
| string | jsonString | The blueprint json string. |
| Vec3 | worldPosition? | World position of import. If importTransforms is enabled position is applied to the imported transform. (Defaults to vec3.zero().) |
| Quat | worldRotation? | World rotation of import. If importTransforms is enabled rotation is applied to the imported transform. (Defaults to quat.identity().) |
| boolean | importTransforms? | Import world transforms from bodies. (Defaults to false.) |
| boolean | forceInactive? | Import interactables in an inactive state. (Defaults to false.) |
Returns:
| Type | Description |
|---|---|
| table | The table {Body, ...} of bodies created from the blueprint. |