sm.construction
The Construction api is used for interacting with the shape construction system.
Constants
| Name | Type | Description |
|---|---|---|
constants |
table | Constants used by the construction system. |
constants
Value type: table
Constants used by the construction system.
- subdivideRatio – The physical size of one block.
- subdivideRatio_2 – The physical size of one block divided by two.
- subdivisions – One dividided by subdivideRatio.
- shapeSpacing – Bias value.
{
subdivideRatio = 0.25,
subdivideRatio_2 = 0.125,
subdivisions = 4,
shapeSpacing = 0.004,
}
Server + Client
validateLocalPosition - Shape
sm.construction.validateLocalPosition( uuid, localPosition, localNormal, shape )
Validates if a shape can be built on another shape.
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The uuid of the shape to validate. |
localPosition |
Vec3 | The position local to the body. |
localNormal |
Vec3 | The normal of the surface to validate placement. |
shape |
Shape | The shape to build on. |
Returns:
| Type | Description |
|---|---|
| boolean | True if position is valid. |
validateLocalPosition - Joint
sm.construction.validateLocalPosition( uuid, localPosition, localNormal, joint )
Validates if a shape can be built on another joint.
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The uuid of the shape to validate. |
localPosition |
Vec3 | The position local to the body. |
localNormal |
Vec3 | The normal of the surface to validate placement. |
joint |
Joint | The joint to build on. |
Returns:
| Type | Description |
|---|---|
| boolean | True if position is valid. |
validateLocalPosition - 3 arguments
sm.construction.validateLocalPosition( uuid, localPosition, localNormal )
Validates if a shape can be built on terrain.
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The uuid of the shape to validate. |
localPosition |
Vec3 | The position local to the body. |
localNormal |
Vec3 | The normal of the surface to validate placement. |
Returns:
| Type | Description |
|---|---|
| boolean | True if position is valid. |
Server-only
buildBlock - Shape
sm.construction.buildBlock( uuid, localPosition, shape )
Builds a block on a shape.
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The uuid of the block to build. |
localPosition |
Vec3 | The position to build the block on. |
shape |
Shape | The shape to build on. |
buildBlock - Joint
sm.construction.buildBlock( uuid, localPosition, joint )
Builds a block on a joint.
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The uuid of the block to build. |
localPosition |
Vec3 | The position to build the block on. |
joint |
Joint | The joint to build on. |
buildBlock - Lift
sm.construction.buildBlock( uuid, localPosition, lift )
Builds a block a lift.
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The uuid of the block to build. |
localPosition |
Vec3 | The position to build the block on. |
lift |
Lift | The lift to build on. |
buildBlock - 2 arguments
sm.construction.buildBlock( uuid, localPosition )
Builds a block on terrain.
Parameters: