LineObject - stingray.LineObject object reference - Stingray Lua API Reference

stingray.LineObject object reference

Description

Used to draw debug lines in the game world.

A LineObject is created with World.create_line_object().

You can add lines to a line object by calling the add_* functions, and queue it for rendering by calling dispatch(). The lines in a line object are not cleared automatically between frames, so any lines you add will persist on screen as long as you continue to dispatch the line object. Call reset() to clear the lines of a line object.

To draw lines that follow a moving object, call reset() every frame to clear out the old lines, then add the new lines for the object's new position before you call dispatch().

Functions

Parameters

self :

stingray.LineObject

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

pose :

stingray.Matrix4x4

Specifies the position and orientation of the axes.

length :

stingray.Vector3?

The length of the axes lines. Defaults to 1.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.

Colors are fixed: X is red, Y is green, Z is blue.

Parameters

self :

stingray.LineObject

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

color :

stingray.Vector4

The color of the box. This is an ARGB value stored in a Vector4 with each component ranging from 0-255. You can create such a value by calling Color(), passing three arguments for an RGB value or four for an ARGB value. To draw a bright yellow line, for example, you would use Color(255, 255, 0).

pose :

stingray.Matrix4x4

Specifies the position and orientation of the box.

extents :

stingray.Vector3

The size of the box along its local right, forward and up axes.

Returns
This function does not return any values.
Parameters

self :

stingray.LineObject

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

color :

stingray.Vector4

The color of the capsule. This is an ARGB value stored in a Vector4 with each component ranging from 0-255. You can create such a value by calling Color(), passing three arguments for an RGB value or four for an ARGB value. To draw a bright yellow line, for example, you would use Color(255, 255, 0).

from :

stingray.Vector3

The start point.

to :

stingray.Vector3

The end point.

radius :

number

The radius of the capsule.

segments :

integer?

Optional; The number of line segments in each circle. If omitted, the default value of 20 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

circles :

integer?

Optional; The number of circles along the length of the capsule. If omitted, the default value of 4 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

bars :

integer?

Optional; The number of bars in the capsule. If omitted, the default value of 10 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.

The segments, circles and bars parameters specify how detailed to make the capsule.

Parameters

self :

stingray.LineObject

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

color :

stingray.Vector4

The color of the circle. This is an ARGB value stored in a Vector4 with each component ranging from 0-255. You can create such a value by calling Color(), passing three arguments for an RGB value or four for an ARGB value. To draw a bright yellow line, for example, you would use Color(255, 255, 0).

center :

stingray.Vector3

The center point of the circle.

radius :

number

The radius of the circle.

normal :

stingray.Vector3

The normal vector.

segments :

integer?

Optional; The number of line segments that will be used to draw the circle. If omitted, the default value of 20 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

self :

stingray.LineObject

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

color :

stingray.Vector4

The color of the cone. This is an ARGB value stored in a Vector4 with each component ranging from 0-255. You can create such a value by calling Color(), passing three arguments for an RGB value or four for an ARGB value. To draw a bright yellow line, for example, you would use Color(255, 255, 0).

from :

stingray.Vector3

The start point.

to :

stingray.Vector3

The end point.

radius :

number

The radius of the base of the cone.

segments :

integer?

Optional; The number of line segments in the cone. If omitted, the default value of 20 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

bars :

integer?

Optional; The number of bars in the cone. If omitted, the default value of 10 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

self :

stingray.LineObject

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

color :

stingray.Vector4

The color of the sphere. This is an ARGB value stored in a Vector4 with each component ranging from 0-255. You can create such a value by calling Color(), passing three arguments for an RGB value or four for an ARGB value. To draw a bright yellow line, for example, you would use Color(255, 255, 0).

center :

stingray.Vector3

The center point of the sphere.

radius :

number

The radius of the sphere.

normal :

stingray.Vector3

The normal vector.

segments :

integer?

Optional; The number of line segments that will be used to draw each circle. If omitted, the default value of 20 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

parts :

integer?

Optional; The number of circles in the half-sphere. If omitted, the default value of 2 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

self :

stingray.LineObject

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

color :

stingray.Vector4

The color of the line. This is an ARGB value stored in a Vector4 with each component ranging from 0-255. You can create such a value by calling Color(), passing three arguments for an RGB value or four for an ARGB value. To draw a bright yellow line, for example, you would use Color(255, 255, 0).

from :

stingray.Vector3

The starting point of the line.

to :

stingray.Vector3

The ending point of the line.

Returns
This function does not return any values.
Parameters

self :

stingray.LineObject

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

color :

stingray.Vector4

The color of the sphere. This is an ARGB value stored in a Vector4 with each component ranging from 0-255. You can create such a value by calling Color(), passing three arguments for an RGB value or four for an ARGB value. To draw a bright yellow line, for example, you would use Color(255, 255, 0).

center :

stingray.Vector3

The center point of the sphere.

radius :

number

The radius of the sphere.

segments :

integer?

Optional; The number of line segments that will be used to draw each circle. If omitted, the default value of 20 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

parts :

integer?

Optional; The number of circles in the sphere. If omitted, the default value of 2 is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

world :

stingray.World

The world where the line object is rendered.

line_object :

stingray.LineObject

The line object to dispatch for rendering.

Returns
This function does not return any values.

The world should be the same world that created the line object.

Parameters

self :

stingray.LineObject

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns
This function does not return any values.