sm.debugDraw

The Debug Draw api can be used for drawing geometric primitives for debug purposes.

Functions:

  • addArrow
  • addSphere
  • addTransform
  • clear
  • removeArrow
  • removeSphere
  • removeTransform

  • sm.debugDraw.addArrow(name, from, to=nil, color=nil)

    Adds a named arrow debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug arrow name.
    Vec3fromThe from position.
    Vec3to=nilThe to position. Defaults to the from position plus one along the z axis. (World up vector)
    Colorcolor=nilThe color. Defaults to white.

    sm.debugDraw.addSphere(name, center, radius=nil, color=nil)

    Adds a named sphere debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug sphere name.
    Vec3centerThe sphere center.
    Vec3radius=nilThe sphere radius. Defaults to 0.125.
    Colorcolor=nilThe color. Defaults to white.

    sm.debugDraw.addTransform(name, origin, rotation, scale=nil)

    Adds a named transform debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug transform name.
    Vec3originThe transform origin.
    QuatrotationThe transform rotation.
    numberscale=nilThe transform scale. Defaults to 1.0.

    sm.debugDraw.clear(name="")

    Removes all debug draws beginning with a given name.

    Parameters:

    TypeNameDescription
    stringname=""The name to match (Defaults to "", matching all debug draws).

    sm.debugDraw.removeArrow(name)

    Removes a named arrow debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug arrow name.

    sm.debugDraw.removeSphere(name)

    Removes a named sphere debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug sphere name.

    sm.debugDraw.removeTransform(name)

    Removes a named transform debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug transform name.