sm.debugDraw
The Debug Draw api can be used for drawing geometric primitives for debug purposes.
Functions:
sm.debugDraw.addAabb(name, min, max, color?)
Adds a named aabb debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The debug transform name. |
| Vec3 | min | The box minimum extent. |
| Vec3 | max | The box maximum extent. |
| Color | color? | The color. Defaults to white. |
sm.debugDraw.addArrow(name, from, to?, color?)
Adds a named arrow debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The debug arrow name. |
| Vec3 | from | The from position. |
| Vec3 | to? | The to position. Defaults to the from position plus one along the z axis. (World up vector) |
| Color | color? | The color. Defaults to white. |
sm.debugDraw.addBox(name, min, max, position, rotation?, color?)
Adds a named box debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The debug transform name. |
| Vec3 | min | The box minimum extent. |
| Vec3 | max | The box maximum extent. |
| Vec3 | position | The box position. |
| Quat | rotation? | The box rotation. Defaults to identity. |
| Color | color? | The color. Defaults to white. |
sm.debugDraw.addSphere(name, center, radius?, color?)
Adds a named sphere debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The debug sphere name. |
| Vec3 | center | The sphere center. |
| number | radius? | The sphere radius. Defaults to 0.125. |
| Color | color? | The color. Defaults to white. |
sm.debugDraw.addText(name, text, position, fade?, scale?, color?)
Adds text in world debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The text name. |
| string | text | The text content. |
| Vec3 | position | The world position of the text. |
| boolean | fade? | If the text should fade. Defaults to false. |
| number | scale? | The scale of the text. Defaults to 30. |
| Color | color? | The color. Defaults to white. |
sm.debugDraw.addTransform(name, origin, rotation, scale?)
Adds a named transform debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The debug transform name. |
| Vec3 | origin | The transform origin. |
| Quat | rotation | The transform rotation. |
| number | scale? | The transform scale. Defaults to 1.0. |
sm.debugDraw.clear(name?)
Removes all debug draws beginning with a given name.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name? | The name to match (Defaults to "", matching all debug draws). |
sm.debugDraw.drawArrowTopDown(from, to?, color?)
Draws an arrow.
Parameters:
| Type | Name | Description |
|---|---|---|
| Vec3 | from | The starting position of the arrow. |
| Vec3 | to? | The ending position of the arrow. Defaults to the starting position plus one unit along the z-axis (world up vector). |
| Color | color? | The color of the arrow. Defaults to white. |
sm.debugDraw.drawBoxTopDown(min, max, position, rotation?, color?, duration?)
Draws a box.
Parameters:
| Type | Name | Description |
|---|---|---|
| Vec3 | min | The minimum extent of the box. |
| Vec3 | max | The maximum extent of the box. |
| Vec3 | position | The position of the box. |
| Quat | rotation? | The rotation of the box. Defaults to identity. |
| Color | color? | The color of the box. Defaults to white. |
| number | duration? | The duration of the flash animation in seconds. Defaults to 0.5 seconds. |
sm.debugDraw.drawCircleTopDown(center, radius?, color?)
Draws a circle.
Parameters:
| Type | Name | Description |
|---|---|---|
| Vec3 | center | The center position of the circle. |
| number | radius? | The radius of the circle. Defaults to 0.125. |
| Color | color? | The color of the circle. Defaults to white. |
sm.debugDraw.drawRectTopDown(min, max, color?)
Draws a rectangle.
Parameters:
| Type | Name | Description |
|---|---|---|
| Vec3 | min | The minimum extent of the rectangle. |
| Vec3 | max | The maximum extent of the rectangle. |
| Color | color? | The color of the rectangle. Defaults to white. |
sm.debugDraw.drawSphereTopDown(center, radius?, color?)
Draws a sphere.
Parameters:
| Type | Name | Description |
|---|---|---|
| Vec3 | center | The center position of the sphere. |
| number | radius? | The radius of the sphere. Defaults to 0.125. |
| Color | color? | 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:
| Type | Name | Description |
|---|---|---|
| Vec3 | min | The minimum world extent of the box. |
| Vec3 | max | The maximum world extent of the box. |
| Color | color? | The color of the box. Defaults to white. |
| number | duration? | 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:
| Type | Name | Description |
|---|---|---|
| Vec3 | from | The starting position of the arrow. |
| Vec3 | to? | The ending position of the arrow. Defaults to the starting position plus one unit along the z-axis (world up vector). |
| Color | color? | The color of the arrow. Defaults to white. |
| number | duration? | 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:
| Type | Name | Description |
|---|---|---|
| Vec3 | from | The starting position of the arrow. |
| Vec3 | to? | The ending position of the arrow. Defaults to the starting position plus one unit along the z-axis (world up vector). |
| Color | color? | The color of the arrow. Defaults to white. |
| number | duration? | 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:
| Type | Name | Description |
|---|---|---|
| Vec3 | min | The minimum extent of the box. |
| Vec3 | max | The maximum extent of the box. |
| Vec3 | position | The position of the box. |
| Quat | rotation? | The rotation of the box. Defaults to identity. |
| Color | color? | The color of the box. Defaults to white. |
| number | duration? | 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:
| Type | Name | Description |
|---|---|---|
| Vec3 | min | The minimum extent of the box. |
| Vec3 | max | The maximum extent of the box. |
| Vec3 | position | The position of the box. |
| Quat | rotation? | The rotation of the box. Defaults to identity. |
| Color | color? | The color of the box. Defaults to white. |
| number | duration? | 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:
| Type | Name | Description |
|---|---|---|
| Vec3 | center | The center position of the circle. |
| number | radius? | The radius of the circle. Defaults to 0.125. |
| Color | color? | The color of the circle. Defaults to white. |
| number | duration? | 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:
| Type | Name | Description |
|---|---|---|
| Vec3 | min | The minimum extent of the rectangle. |
| Vec3 | max | The maximum extent of the rectangle. |
| Color | color? | The color of the rectangle. Defaults to white. |
| number | duration? | 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:
| Type | Name | Description |
|---|---|---|
| Vec3 | center | The center position of the sphere. |
| number | radius? | The radius of the sphere. Defaults to 0.125. |
| Color | color? | The color of the sphere. Defaults to white. |
| number | duration? | 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:
| Type | Name | Description |
|---|---|---|
| Vec3 | center | The center position of the sphere. |
| number | radius? | The radius of the sphere. Defaults to 0.125. |
| Color | color? | The color of the sphere. Defaults to white. |
| number | duration? | 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:
| Type | Name | Description |
|---|---|---|
| string | text | The text content. |
| Vec3 | position | The world position of the text. |
| boolean | fade? | If the text should fade. Defaults to false. |
| number | scale? | The scale of the text. Defaults to 30. |
| Color | color? | The color. Defaults to white. |
| number | time? | Time to show text. Defaults to 0.5. |
sm.debugDraw.removeArrow(name)
Removes a named arrow debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The debug arrow name. |
sm.debugDraw.removeBox(name)
Removes a named box debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The debug box name. |
sm.debugDraw.removeSphere(name)
Removes a named sphere debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The debug sphere name. |
sm.debugDraw.removeText(name)
Remove text in world debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The text name. |
sm.debugDraw.removeTransform(name)
Removes a named transform debug draw.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | name | The debug transform name. |