sm.debugDraw

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

Functions:

  • addAabb
  • addArrow
  • addBox
  • addSphere
  • addText
  • addTransform
  • clear
  • drawArrowTopDown
  • drawBoxTopDown
  • drawCircleTopDown
  • drawRectTopDown
  • drawSphereTopDown
  • flashAabb
  • flashArrow
  • flashArrowTopDown
  • flashBox
  • flashBoxTopDown
  • flashCircleTopDown
  • flashRectTopDown
  • flashSphere
  • flashSphereTopDown
  • flashText
  • removeArrow
  • removeBox
  • removeSphere
  • removeText
  • removeTransform

  • sm.debugDraw.addAabb(name, min, max, color?)

    Adds a named aabb debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug transform name.
    Vec3minThe box minimum extent.
    Vec3maxThe box maximum extent.
    Colorcolor?The color. Defaults to white.

    sm.debugDraw.addArrow(name, from, to?, color?)

    Adds a named arrow debug draw.

    Parameters:

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

    sm.debugDraw.addBox(name, min, max, position, rotation?, color?)

    Adds a named box debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug transform name.
    Vec3minThe box minimum extent.
    Vec3maxThe box maximum extent.
    Vec3positionThe box position.
    Quatrotation?The box rotation. Defaults to identity.
    Colorcolor?The color. Defaults to white.

    sm.debugDraw.addSphere(name, center, radius?, color?)

    Adds a named sphere debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug sphere name.
    Vec3centerThe sphere center.
    numberradius?The sphere radius. Defaults to 0.125.
    Colorcolor?The color. Defaults to white.

    sm.debugDraw.addText(name, text, position, fade?, scale?, color?)

    Adds text in world debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe text name.
    stringtextThe text content.
    Vec3positionThe world position of the text.
    booleanfade?If the text should fade. Defaults to false.
    numberscale?The scale of the text. Defaults to 30.
    Colorcolor?The color. Defaults to white.

    sm.debugDraw.addTransform(name, origin, rotation, scale?)

    Adds a named transform debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug transform name.
    Vec3originThe transform origin.
    QuatrotationThe transform rotation.
    numberscale?The 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.drawArrowTopDown(from, to?, color?)

    Draws an arrow.

    Parameters:

    TypeNameDescription
    Vec3fromThe starting position of the arrow.
    Vec3to?The ending position of the arrow. Defaults to the starting position plus one unit along the z-axis (world up vector).
    Colorcolor?The color of the arrow. Defaults to white.

    sm.debugDraw.drawBoxTopDown(min, max, position, rotation?, color?, duration?)

    Draws a box.

    Parameters:

    TypeNameDescription
    Vec3minThe minimum extent of the box.
    Vec3maxThe maximum extent of the box.
    Vec3positionThe position of the box.
    Quatrotation?The rotation of the box. Defaults to identity.
    Colorcolor?The color of the box. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.drawCircleTopDown(center, radius?, color?)

    Draws a circle.

    Parameters:

    TypeNameDescription
    Vec3centerThe center position of the circle.
    numberradius?The radius of the circle. Defaults to 0.125.
    Colorcolor?The color of the circle. Defaults to white.

    sm.debugDraw.drawRectTopDown(min, max, color?)

    Draws a rectangle.

    Parameters:

    TypeNameDescription
    Vec3minThe minimum extent of the rectangle.
    Vec3maxThe maximum extent of the rectangle.
    Colorcolor?The color of the rectangle. Defaults to white.

    sm.debugDraw.drawSphereTopDown(center, radius?, color?)

    Draws a sphere.

    Parameters:

    TypeNameDescription
    Vec3centerThe center position of the sphere.
    numberradius?The radius of the sphere. Defaults to 0.125.
    Colorcolor?The color of the sphere. Defaults to white.

    sm.debugDraw.flashAabb(min, max, color?, duration?)

    Flashes an axis-aligned bounding box for a specified duration.

    Parameters:

    TypeNameDescription
    Vec3minThe minimum world extent of the box.
    Vec3maxThe maximum world extent of the box.
    Colorcolor?The color of the box. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.flashArrow(from, to?, color?, duration?)

    Flashes an arrow for a specified duration.

    Parameters:

    TypeNameDescription
    Vec3fromThe starting position of the arrow.
    Vec3to?The ending position of the arrow. Defaults to the starting position plus one unit along the z-axis (world up vector).
    Colorcolor?The color of the arrow. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.flashArrowTopDown(from, to?, color?, duration?)

    Flashes an arrow for a specified duration.

    Parameters:

    TypeNameDescription
    Vec3fromThe starting position of the arrow.
    Vec3to?The ending position of the arrow. Defaults to the starting position plus one unit along the z-axis (world up vector).
    Colorcolor?The color of the arrow. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.flashBox(min, max, position, rotation?, color?, duration?)

    Flashes a box for a specified duration.

    Parameters:

    TypeNameDescription
    Vec3minThe minimum extent of the box.
    Vec3maxThe maximum extent of the box.
    Vec3positionThe position of the box.
    Quatrotation?The rotation of the box. Defaults to identity.
    Colorcolor?The color of the box. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.flashBoxTopDown(min, max, position, rotation?, color?, duration?)

    Flashes a box for a specified duration.

    Parameters:

    TypeNameDescription
    Vec3minThe minimum extent of the box.
    Vec3maxThe maximum extent of the box.
    Vec3positionThe position of the box.
    Quatrotation?The rotation of the box. Defaults to identity.
    Colorcolor?The color of the box. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.flashCircleTopDown(center, radius?, color?, duration?)

    Flashes a circle for a specified duration.

    Parameters:

    TypeNameDescription
    Vec3centerThe center position of the circle.
    numberradius?The radius of the circle. Defaults to 0.125.
    Colorcolor?The color of the circle. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.flashRectTopDown(min, max, color?, duration?)

    Flashes a rectangle for a specified duration.

    Parameters:

    TypeNameDescription
    Vec3minThe minimum extent of the rectangle.
    Vec3maxThe maximum extent of the rectangle.
    Colorcolor?The color of the rectangle. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.flashSphere(center, radius?, color?, duration?)

    Flashes a sphere for a specified duration.

    Parameters:

    TypeNameDescription
    Vec3centerThe center position of the sphere.
    numberradius?The radius of the sphere. Defaults to 0.125.
    Colorcolor?The color of the sphere. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.flashSphereTopDown(center, radius?, color?, duration?)

    Flashes a sphere for a specified duration.

    Parameters:

    TypeNameDescription
    Vec3centerThe center position of the sphere.
    numberradius?The radius of the sphere. Defaults to 0.125.
    Colorcolor?The color of the sphere. Defaults to white.
    numberduration?The duration of the flash animation in seconds. Defaults to 0.5 seconds.

    sm.debugDraw.flashText(text, position, fade?, scale?, color?, time?)

    Draws text in world debug draw.

    Parameters:

    TypeNameDescription
    stringtextThe text content.
    Vec3positionThe world position of the text.
    booleanfade?If the text should fade. Defaults to false.
    numberscale?The scale of the text. Defaults to 30.
    Colorcolor?The color. Defaults to white.
    numbertime?Time to show text. Defaults to 0.5.

    sm.debugDraw.removeArrow(name)

    Removes a named arrow debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug arrow name.

    sm.debugDraw.removeBox(name)

    Removes a named box debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug box name.

    sm.debugDraw.removeSphere(name)

    Removes a named sphere debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug sphere name.

    sm.debugDraw.removeText(name)

    Remove text in world debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe text name.

    sm.debugDraw.removeTransform(name)

    Removes a named transform debug draw.

    Parameters:

    TypeNameDescription
    stringnameThe debug transform name.