sm.shape

A shape is any block, part or basic material that can be built by a player. Shapes are always connected to a Body, which is a collection of shapes.

For more information about creating your own scripted shapes, see ShapeClass.

Constants

Name Type Description
destructionType table The destruction type list.
material table The physics material types list.

destructionType

Value type: table

Shape destruction types. Using these will handle the destruction as if it was caused by the specified type.

{
    None,
    Melee,
    Projectile,
    Explosion,
}

material

Value type: table

Shape physics materials

{
    None,
    Default,
    Grass,
    Dirt,
    Sand,
    Gravel,
    Rock,
    Wood,
    Plastic,
    Metal,
    Glass,
    Fence,
    Fabric,
    Cardboard,
    Foliage,
    Tape,
    Water,
    WaterSubmerged,
    RagdollHuman,
    Mechanical,
    Fruit,
    RagdollAnimal,
    Electronics,
    Sticky,
    Ice,
    Bubblewrap,
    Scrapmetal,
    Rewardlocker,
    Chili,
    VoxelBlueRock,
    VoxelPurpleRock,
    VoxelRedRock,
    VoxelBlueMineral,
    VoxelPurpleMineral,
    VoxelRedMineral,
}

Server + Client

getIsHarvest

sm.shape.getIsHarvest( uuid )

Return whether the shape uuid belongs to a harvest shape

Parameters:

Name Type Description
uuid Uuid The shape uuid.

Returns:

Type Description
boolean True if the shape is harvestable.

getIsStackable

sm.shape.getIsStackable( uuid )

Return whether the shape uuid belongs to a stackable shape

Parameters:

Name Type Description
uuid Uuid The shape uuid.

Returns:

Type Description
boolean True if the shape is stackable.

getShapeDescription

sm.shape.getShapeDescription( uuid )

Returns the block/part description for the given uuid.

Parameters:

Name Type Description
uuid Uuid The uuid.

Returns:

Type Description
string The shape description.

getShapeIcon

sm.shape.getShapeIcon(  )

Deprecated: Deprecated function. Kept for compability with old scripts.

Does nothing.

getShapeTitle

sm.shape.getShapeTitle( uuid )

Returns the block/part name for the given uuid.

Parameters:

Name Type Description
uuid Uuid The uuid.

Returns:

Type Description
string The shape title.

getShapeTypeColor

sm.shape.getShapeTypeColor( uuid )

Returns the color of the uuid's shape type

Parameters:

Name Type Description
uuid Uuid The uuid of the shape.

Returns:

Type Description
Color The color of the shape type.

getShapeUpperCaseTitle

sm.shape.getShapeUpperCaseTitle( uuid )

Returns the block/part name for the given uuid in uppercase as given in the inventory description translations. Defaults to the shape title if an upper case version does not exist.

Parameters:

Name Type Description
uuid Uuid The uuid.

Returns:

Type Description
string The shape title in upper case.

shapesInSphere

sm.shape.shapesInSphere( center, radius )

Returns a table of all shapes colliding with a given sphere.

Parameters:

Name Type Description
center Vec3 The center position of the sphere.
radius number The radius of the sphere.

Returns:

Type Description
table The table of found shapes. {Shape, ..}

uuidExists

sm.shape.uuidExists( uuid )

Return whether the shape uuid exists

Parameters:

Name Type Description
uuid Uuid The shape uuid.

Returns:

Type Description
boolean exists.

Server-only

createBlock

sm.shape.createBlock( uuid, size, position, rotation, dynamic, forceSpawn )

Create a new block

Parameters:

Name Type Description
uuid Uuid The uuid of the shape.
size Vec3 The size of the block.
position Vec3 The shape's world position.
rotation (optional) Quat The shape's world rotation. Defaults to no rotation (Optional)
dynamic (optional) boolean Set true if the shape is dynamic or false if the shape is static. Defaults to true (Optional)
forceSpawn (optional) boolean Set true to force spawn the shape even if it will cause collision. Defaults to true (Optional)

Returns:

Type Description
Shape The created block

createPart

sm.shape.createPart( uuid, position, rotation, dynamic, forceSpawn, world )

Create a new part

Parameters:

Name Type Description
uuid Uuid The uuid of the shape.
position Vec3 The shape's world position.
rotation Quat The shape's world rotation. Defaults to no rotation (Optional)
dynamic (optional) boolean Set true if the shape is dynamic or false if the shape is static. Defaults to true (Optional)
forceSpawn (optional) boolean Set true to force spawn the shape even if it will cause collision. Defaults to true (Optional)
world (optional) World The world to create the part in. Uses the script's world by default. (Optional)

Returns:

Type Description
Shape The created part

createWedge

sm.shape.createWedge( uuid, size, position, rotation, dynamic, forceSpawn )

Creates a wedge. The wedge is oriented with one

cathetus along the Y-axis and the other along the Z-axis, forming a right angle.

Parameters:

Name Type Description
uuid Uuid The uuid of the shape.
size Vec3 The size of the wedge.
position Vec3 The shape's world position.
rotation (optional) Quat The shape's world rotation. Defaults to no rotation (Optional)
dynamic (optional) boolean Set true if the shape is dynamic or false if the shape is static. Defaults to true (Optional)
forceSpawn (optional) boolean Set true to force spawn the shape even if it will cause collision. Defaults to true (Optional)

Returns:

Type Description
Shape The created wedge