sm.visualization
Visualization is used for visualizing game objects.
Client-only
createBlueprint - path
sm.visualization.createBlueprint( path )
Create a BlueprintVisualization from a blueprint file path.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | A file path to the blueprint to be visualized |
Returns:
| Type | Description |
|---|---|
| BlueprintVisualization | The blueprint visualization |
createBlueprint - blueprintTable
sm.visualization.createBlueprint( blueprintTable )
Create a BlueprintVisualization from a blueprint table.
Parameters:
| Name | Type | Description |
|---|---|---|
blueprintTable |
table | Table with blueprint information to be visualized |
Returns:
| Type | Description |
|---|---|
| BlueprintVisualization | The blueprint visualization |
createBuilderGuide
sm.visualization.createBuilderGuide(
path,
shape,
ignoreBlockUuid,
completeEffectName,
completeEffectAtBaseName
)
Create a builder guide BlueprintVisualization, comparing the creation from the root Shape to the blueprint give by path.
The builder guide blueprint contains stage indices based on shape color, stage color order is the same as the color order in the PaintTool color picker.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | A file path to the builder guide blueprint |
shape |
Shape | Root Shape for comparing the creation from |
ignoreBlockUuid (optional) |
boolean | Should block uuid be evaluated for stage completion (Defaults to false) |
completeEffectName (optional) |
string | The name of the effect that should be played at the placed block once the builder guide stage is completed (Defaults to "") |
completeEffectAtBaseName (optional) |
string | The name of the effect that should be played at the base once the builder guide stage is completed (Defaults to "") |
Returns:
| Type | Description |
|---|---|
| BlueprintVisualization | The builder guide blueprint visualization |
drawLine
sm.visualization.drawLine( startingPoint, endPoint, color )
Adds a builderguide connection guide line between two points.
Parameters:
| Name | Type | Description |
|---|---|---|
startingPoint |
Vec3 | The starting point for the line. |
endPoint |
Vec3 | The end point for the line. |
color (optional) |
Color | The color for the line. Defaults to yellow. (Optional) |
getShapePlacementVisualization
sm.visualization.getShapePlacementVisualization( )
Returns a table containing the current state of the shape placement visualization.
Returns:
| Type | Description |
|---|---|
| table | Table containing { worldPosition = Vec3, worldRotation = Quat, shapeUuid = Uuid, isLegal = boolean }. |
setBlockVisualization - Shape
sm.visualization.setBlockVisualization( position, illegal, shape )
Visualizes a block on a shape
Parameters:
| Name | Type | Description |
|---|---|---|
position |
Vec3 | The local space position |
illegal (optional) |
boolean | Whether the visualization should render as illegal (Defaults to false) |
shape |
Shape | Shape to visualize on |
setBlockVisualization - Joint
sm.visualization.setBlockVisualization( position, illegal, joint )
Visualizes a block on a joint
Parameters:
| Name | Type | Description |
|---|---|---|
position |
Vec3 | The local space position |
illegal (optional) |
boolean | Whether the visualization should render as illegal (Defaults to false) |
joint |
Joint | joint to visualize on |
setBlockVisualization - 2 arguments
sm.visualization.setBlockVisualization( position, illegal )
Visualizes a block in world space
Parameters:
| Name | Type | Description |
|---|---|---|
position |
Vec3 | The world space position |
illegal (optional) |
boolean | Whether the visualization should render as illegal (Defaults to false) |
setCreationBodies
sm.visualization.setCreationBodies( bodies )
Sets an array of bodies to visualize.
Parameters:
| Name | Type | Description |
|---|---|---|
bodies |
table | Array of bodies to visualize {Body, ..}. |
setCreationFreePlacement
sm.visualization.setCreationFreePlacement( valid )
Controls the transform of the creation visualization. If true the visualization will render using setFreePlacementPosition/setFreePlacementRotation functions.
If false the visualization will render on top of the creation.
Parameters:
| Name | Type | Description |
|---|---|---|
valid |
boolean | Should the creation visualization be free placement |
setCreationFreePlacementPosition
sm.visualization.setCreationFreePlacementPosition( position )
Set the world position of the creation visualization. Only works if setFreePlacement is true.
Parameters:
| Name | Type | Description |
|---|---|---|
position |
Vec3 | World position of the creation visualization |
setCreationFreePlacementRotation
sm.visualization.setCreationFreePlacementRotation( index )
Set the rotation index of the creation visualization. Only works if setFreePlacement is true.
Parameters:
| Name | Type | Description |
|---|---|---|
index |
integer | Index to rotate the creation visualization with |
setCreationValid
sm.visualization.setCreationValid( valid, lift )
Controls the rendering of the creation visualization.
Parameters:
| Name | Type | Description |
|---|---|---|
valid |
boolean | Should the visualization should render be valid |
lift (optional) |
boolean | Should the visualization should render be lift or place (Defaults to false) |
setCreationVisible
sm.visualization.setCreationVisible( visible )
Controls the visibility of the creation visualization
Parameters:
| Name | Type | Description |
|---|---|---|
visible |
boolean | Should the creation visualization be visible |
setLiftLevel
sm.visualization.setLiftLevel( level )
Set the lift level of the lift visualization.
Parameters:
| Name | Type | Description |
|---|---|---|
level |
integer | The level of the lift |
setLiftPosition
sm.visualization.setLiftPosition( position )
Set the world position of the lift visualization.
Parameters:
| Name | Type | Description |
|---|---|---|
position |
Vec3 | World position of the lift visualization |
setLiftValid
sm.visualization.setLiftValid( valid )
Controls the rendering of the lift visualization.
Parameters:
| Name | Type | Description |
|---|---|---|
valid |
boolean | Whether the visualization should render as valid |
setLiftVisible
sm.visualization.setLiftVisible( visible )
Controls the visibility of the lift visualization
Parameters:
| Name | Type | Description |
|---|---|---|
visible |
boolean | Whether the lift visualization is visible |