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

stingray.Broadphase object reference

Description

A data structure that you can use to quickly search for units in a game level.

The units inserted into the broadphase get sorted into a grid for quick access.

Functions

Parameters

self :

stingray.Broadphase

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

unit :

stingray.Unit

The new unit to add.

pos :

stingray.Vector3

The position of the unit.

radius :

number

The radius of the unit.

Returns

integer

An item ID that you can use for manipulating the item.

Parameters

self :

stingray.Broadphase

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

broadphase_entry[]

A table that contains an entry for each item in the broadphase.

The [] notation indicates that this type is an array: a table in which the keys of the members are sequential integers, and the value of each element is an instance of the type shown.
Parameters

self :

stingray.Broadphase

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

item :

number

The ID of the item to move. Must be a value previously returned by Broadphase:add().

pos :

stingray.Vector3

The new position for the item.

Returns
This function does not return any values.
Parameters

self :

stingray.Broadphase

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

pos :

stingray.Vector3

The position of the center of the search space.

radius :

number

The radius of the search space.

results :

stingray.Unit[]

A table that will be updated to contain all of the units that intersect the search space.

The [] notation indicates that this type is an array: a table in which the keys of the members are sequential integers, and the value of each element is an instance of the type shown.
Returns

integer

The number of units found by the query.

Parameters

self :

stingray.Broadphase

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

item :

number

The ID of the item to remove. Must be a value previously returned by Broadphase:add().

Returns
This function does not return any values.