sm.creation
A Creation represent a collection of bodies linked together by joints.
Functions
exportToString
sm.creation.exportToString( body, exportTransforms, forceDynamic )
Server-Only
Exports a creation to a blueprint formatted json string.
Arguments:body
[ Body ]: Any body in the creation.exportTransforms
[ bool ]: Export the current world transform of bodies. Defaults to false.forceDynamic
[ bool ]: Force export to dynamic bodies. Defaults to false.
- [ string ]: The blueprint json string.
exportToTable
sm.creation.exportToTable( body, exportTransforms, forceDynamic )
Server-Only
Exports a creation to a blueprint Lua table.
Arguments:body
[ Body ]: Any body in the creation.exportTransforms
[ bool ]: Export the current world transform of bodies. Defaults to false.forceDynamic
[ bool ]: Force export to dynamic bodies. Defaults to false.
- [ table ]: The blueprint Lua table.
importFromFile
sm.creation.importFromFile( world, pathString, worldPosition, worldRotation, importTransforms, indestructible )
Server-Only
Imports a blueprint json file into the world.
If importTransforms
is enabled, the world position and rotation are applied to the imported transform.
warning
If the blueprint was not exported with transforms, the importer will treat it as if importTransforms
was disabled.
world
[ World ]: The world to import to.pathString
[ string ]: The path to the blueprint file.worldPosition
[ Vec3 ]: The world position of the creation. Defaults tosm.vec3.zero()
worldRotation
[quat ]: The world rotation of the creation. Defaults tosm.quat.identity()
importTransforms
[ bool ]: Import world transforms from bodies. Defaults to false.indestructible
[ bool ]: (DEPRECATED, usesetDestructable
on each body in the creation.)
- [ table ]: A table of bodies created from the blueprint.
importFromString
sm.creation.importFromString( world, jsonString, worldPosition, worldRotation, importTransforms, forceInactive )
Server-Only
Imports a blueprint json string into the world.
If importTransforms
is enabled, the world position and rotation are applied to the imported transform.
warning
If the blueprint was not exported with transforms, the importer will treat it as if importTransforms
was disabled.
world
[ World ]: The world to import to.jsonString
[ string ]: The blueprint json string.worldPosition
[ Vec3 ]: The world position of the creation. Defaults tosm.vec3.zero()
worldRotation
[quat ]: The world rotation of the creation. Defaults tosm.quat.identity()
importTransforms
[ bool ]: Import world transforms from bodies. Defaults to false.forceInactive
[ bool ]: Sets whether interactables are forced inactive when imported or not. Defaults to false.
- [ table ]: A table of bodies created from the blueprint.