sm.visualization

Associated object type: BlueprintVisualization

Visualization is used for visualizing game objects.

Functions:

  • createBlueprint
  • createBlueprint
  • createBuilderGuide
  • getShapePlacementVisualization
  • setBlockVisualization
  • setBlockVisualization
  • setBlockVisualization
  • setCreationBodies
  • setCreationFreePlacement
  • setCreationFreePlacementPosition
  • setCreationFreePlacementRotation
  • setCreationValid
  • setCreationVisible
  • setLiftLevel
  • setLiftPosition
  • setLiftValid
  • setLiftVisible

  • sm.visualization.createBlueprint(path)

    Client only

    Create a BlueprintVisualization from a blueprint file path.

    Parameters:

    TypeNameDescription
    stringpathA file path to the blueprint to be visualized

    Returns:

    TypeDescription
    BlueprintVisualizationThe blueprint visualization

    sm.visualization.createBlueprint(blueprintTable)

    Client only

    Create a BlueprintVisualization from a blueprint table.

    Parameters:

    TypeNameDescription
    tableblueprintTableTable with blueprint information to be visualized

    Returns:

    TypeDescription
    BlueprintVisualizationThe blueprint visualization

    sm.visualization.createBuilderGuide(path, shape, ignoreBlockUuid=false, completeEffectName="")

    Client only

    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:

    TypeNameDescription
    stringpathA file path to the builder guide blueprint
    ShapeshapeRoot Shape for comparing the creation from
    booleanignoreBlockUuid=falseShould block uuid be evaluated for stage completion
    stringcompleteEffectName=""The name a effect that should be played once the builder guide is completed

    Returns:

    TypeDescription
    BlueprintVisualizationThe builder guide blueprint visualization

    sm.visualization.getShapePlacementVisualization()

    Client only

    Returns a table containing the current state of the shape placement visualization.

    Returns:

    TypeDescription
    tableTable containing { worldPosition = Vec3, worldRotation = Quat, shapeUuid = Uuid, isLegal = boolean }.

    sm.visualization.setBlockVisualization(position, illegal=false, shape)

    Client only

    Visualizes a block on a shape

    Parameters:

    TypeNameDescription
    Vec3positionThe local space position
    booleanillegal=falseWhether the visualization should render as illegal
    ShapeshapeShape to visualize on

    sm.visualization.setBlockVisualization(position, illegal=false, joint)

    Client only

    Visualizes a block on a joint

    Parameters:

    TypeNameDescription
    Vec3positionThe local space position
    booleanillegal=falseWhether the visualization should render as illegal
    Jointjointjoint to visualize on

    sm.visualization.setBlockVisualization(position, illegal=false)

    Client only

    Visualizes a block in world space

    Parameters:

    TypeNameDescription
    Vec3positionThe world space position
    booleanillegal=falseWhether the visualization should render as illegal

    sm.visualization.setCreationBodies(bodies)

    Client only

    Sets an array of bodies to visualize.

    Parameters:

    TypeNameDescription
    tablebodiesArray of bodies to visualize {Body, ..}.

    sm.visualization.setCreationFreePlacement(valid)

    Client only

    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:

    TypeNameDescription
    booleanvalidShould the creation visualization be free placement

    sm.visualization.setCreationFreePlacementPosition(position)

    Client only

    Set the world position of the creation visualization. Only works if setFreePlacement is true.

    Parameters:

    TypeNameDescription
    Vec3positionWorld position of the creation visualization

    sm.visualization.setCreationFreePlacementRotation(index)

    Client only

    Set the rotation index of the creation visualization. Only works if setFreePlacement is true.

    Parameters:

    TypeNameDescription
    integerindexIndex to rotate the creation visualization with

    sm.visualization.setCreationValid(valid, lift=false)

    Client only

    Controls the rendering of the creation visualization.

    Parameters:

    TypeNameDescription
    booleanvalidShould the visualization should render be valid
    booleanlift=falseShould the visualization should render be lift or place

    sm.visualization.setCreationVisible(visible)

    Client only

    Controls the visibility of the creation visualization

    Parameters:

    TypeNameDescription
    booleanvisibleShould the creation visualization be visible

    sm.visualization.setLiftLevel(level)

    Client only

    Set the lift level of the lift visualization.

    Parameters:

    TypeNameDescription
    integerlevelThe level of the lift

    sm.visualization.setLiftPosition(position)

    Client only

    Set the world position of the lift visualization.

    Parameters:

    TypeNameDescription
    Vec3positionWorld position of the lift visualization

    sm.visualization.setLiftValid(valid)

    Client only

    Controls the rendering of the lift visualization.

    Parameters:

    TypeNameDescription
    booleanvalidWhether the visualization should render as valid

    sm.visualization.setLiftVisible(visible)

    Client only

    Controls the visibility of the lift visualization

    Parameters:

    TypeNameDescription
    booleanvisibleWhether the lift visualization is visible