Skip to main content

sm.debugDraw​

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

note

By default, the functions in this library do nothing.
However, their functionality can be restored by installing the DebugDraw DLL mod.

Functions​

addArrow​

sm.debugDraw.addArrow(name, startPos, endPos, color)

Creates a named debug draw arrow.
The arrow's parameters can be updated by calling the function again with the same name.

Parameters:

  • name (string): The debug arrow name.
  • startPos (Vec3): The start position.
  • endPos (Vec3): The end position. Defaults to startPos plus 1 on the Z axis.
  • color (Color): The color. Defaults to white.

addSphere​

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

Creates a named debug draw sphere.
The sphere's parameters can be updated by calling the function again with the same name.

Parameters:

  • name (string): The debug sphere name.
  • center (Vec3): The center position.
  • radius (Vec3): The radius. Defaults to 0.125.
  • color (Color): The color. Defaults to white.

addTransform​

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

Creates a named debug draw transform.
This consists of three debug arrows pointing in the X, Y and Z axis, colored red, green and blue respectively, rotated by the given rotation and scaled by the given scale.
The transform's parameters can be updated by calling the function again with the same name.

Parameters:

  • name (string): The debug transform name.
  • origin (Vec3): The transform origin.
  • rotation (Quat): The transform rotation.
  • scale (number): The transform scale. Defaults to 1.0.

clear​

sm.debugDraw.clear(name)

Removes all debug draws who's name begins with the given string.

Parameters:

  • name (string): The name. Defaults to "", matching all debug draws.

removeArrow​

sm.debugDraw.removeArrow(name)

Removes a debug draw arrow.

Parameters:

  • name (string): The name.

removeSphere​

sm.debugDraw.removeSphere(name)

Removes a debug draw sphere.

Parameters:

  • name (string): The name.

removeTransform​

sm.debugDraw.removeTransform(name)

Removes a debug draw transform.

Parameters:

  • name (string): The name.