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.
Constructors and accessors
Other related reference items
add ( self, unit, pos, radius ) : integerAdds a new unit to the broadphase data structure at the specified position and with the specified radius.
|
self : | 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 : | The new unit to add. | |
pos : | The position of the unit. | |
radius : | number | The radius of the unit. |
integer |
An item ID that you can use for manipulating the item. |
Other related reference items
all ( self ) : broadphase_entry[]Retrieves all entries in the broadphase data structure, typically used for debugging purposes.
|
self : | 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. |
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. |
Other related reference items
move ( self, item, pos )Moves the item to the specified position.
|
self : | 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 : | The new position for the item. |
This function does not return any values. |
query ( self, pos, radius, results ) : integerFinds all the units whose spheres intersect a sphere at the specified position with the specified radius, and returns them by inserting them into the Lua results table.
|
self : | 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 : | The position of the center of the search space. | |
radius : | number | The radius of the search space. |
results : | 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. |
integer |
The number of units found by the query. |
remove ( self, item )Removes the item from the broadphase data structure.
|
self : | 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(). |
This function does not return any values. |