sm.creation

A Creation represent a collection of bodies linked together by joints.

Functions:

  • buildMultiShape
  • exportToString
  • exportToTable
  • getBlueprintCost
  • getBlueprintCost
  • importFromFile
  • importFromString

  • sm.creation.buildMultiShape(shape, worldPosition, worldRotation, localPosition, localRotation)

    Server only

    Builds a multi shape

    Parameters:

    TypeNameDescription
    UuidshapeThe uuid of shape to build.
    Vec3worldPositionWorld position of shape.
    QuatworldRotationWorld rotation of shape.
    Vec3localPositionLocal position of shape.
    QuatlocalRotationLocal rotation of shape.

    sm.creation.exportToString(body, exportTransforms?, forceDynamic?)

    Server only

    Exports creation to blueprint formatted json string.

    Parameters:

    TypeNameDescription
    BodybodyAny body in the creation.
    booleanexportTransforms?Export the current world transform of bodies. Defaults to false.
    booleanforceDynamic?Force export to dynamic bodies. Defaults to false.

    Returns:

    TypeDescription
    stringThe blueprint json string.

    sm.creation.exportToTable(body, exportTransforms?, forceDynamic?)

    Server only

    Exports creation to blueprint lua table.

    Parameters:

    TypeNameDescription
    BodybodyAny body in the creation.
    booleanexportTransforms?Export the current world transform of bodies. Defaults to false.
    booleanforceDynamic?Force export to dynamic bodies. Defaults to false.

    Returns:

    TypeDescription
    tableThe 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:

    TypeNameDescription
    stringfilePathThe file path for the blueprint.
    integerbodyId?The id of a body.(Optional)

    Returns:

    TypeDescription
    tableThe 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:

    TypeNameDescription
    tabletableThe lua table for the blueprint.
    integerbodyId?The id of a body.(Optional)

    Returns:

    TypeDescription
    tableThe 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:

    TypeNameDescription
    WorldworldThe world to import to.
    stringpathStringThe blueprint path.
    Vec3worldPosition?World position of import. If importTransforms is enabled position is applied to the imported transform. (Defaults to vec3.zero().)
    QuatworldRotation?World rotation of import. If importTransforms is enabled rotation is applied to the imported transform. (Defaults to quat.identity().)
    booleanimportTransforms?Import world transforms from bodies. (Defaults to false.)
    booleanindestructible?(DEPRECATED) Ignored, use setDestructable(false) on each body in creation. (Defaults to false)

    Returns:

    TypeDescription
    tableThe 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:

    TypeNameDescription
    WorldworldThe world to import to.
    stringjsonStringThe blueprint json string.
    Vec3worldPosition?World position of import. If importTransforms is enabled position is applied to the imported transform. (Defaults to vec3.zero().)
    QuatworldRotation?World rotation of import. If importTransforms is enabled rotation is applied to the imported transform. (Defaults to quat.identity().)
    booleanimportTransforms?Import world transforms from bodies. (Defaults to false.)
    booleanforceInactive?Import interactables in an inactive state. (Defaults to false.)

    Returns:

    TypeDescription
    tableThe table {Body, ...} of bodies created from the blueprint.