| Package | com.pblabs.rendering2D |
| Class | public class BasicSpatialManager2D |
| Inheritance | BasicSpatialManager2D EntityComponent Object |
| Implements | ISpatialManager2D |
| Property | Defined By | ||
|---|---|---|---|
| _objectList : Array | BasicSpatialManager2D | ||
| Method | Defined By | ||
|---|---|---|---|
addSpatialObject(object:ISpatialObject2D):void
Add a generic spatial object to this manager. | BasicSpatialManager2D | ||
boxVsBox(box1:Rectangle, box2:Rectangle):Boolean
Determines if the two rectangles intersect. | BasicSpatialManager2D | ||
Cast a ray and (optionally) return information about what it hits in result. | BasicSpatialManager2D | ||
getObjectsUnderPoint(worldPosition:Point, results:Array, mask:ObjectType = null):Boolean
Return all the spatial objects under a given point. | BasicSpatialManager2D | ||
queryCircle(center:Point, radius:Number, mask:ObjectType, results:Array):Boolean
Return all the spatial objects that overlap the specified circle. | BasicSpatialManager2D | ||
queryRectangle(box:Rectangle, mask:ObjectType, results:Array):Boolean
Return all the spatial objects that overlap with the specified box and match
one or more of the types in the mask. | BasicSpatialManager2D | ||
![]() |
Registers the component with an entity. | EntityComponent | |
removeSpatialObject(object:ISpatialObject2D):void
Remove a previously registered object from this manager. | BasicSpatialManager2D | ||
![]() | reset():void
This is called by an entity on all of its components any time a component
is added or removed. | EntityComponent | |
![]() | unregister():void
Unregisters the component from an entity. | EntityComponent | |
| Constant | Defined By | ||
|---|---|---|---|
| EntitiesDirtyEvent : String = BasicSpatialManager2D.EntitiesDirty [static]
An event with this name is raised on the owner.eventDispatcher when
the entity list changes via addSpatialObject or removeSpatialObject. | BasicSpatialManager2D | ||
| _objectList | property |
protected var _objectList:Array| addSpatialObject | () | method |
public function addSpatialObject(object:ISpatialObject2D):voidAdd a generic spatial object to this manager. A manager with advanced functionality will support both general ISpatialObject2D implementations as well as enabling special functionality for its peered classes.
Parameters
object:ISpatialObject2D |
| boxVsBox | () | method |
public function boxVsBox(box1:Rectangle, box2:Rectangle):BooleanDetermines if the two rectangles intersect. This, along with the objectMask of the spatial component is used in queryRectangle to determine which spatial components are added to the results array.
Parameters
box1:Rectangle | |
box2:Rectangle |
Boolean |
| castRay | () | method |
public function castRay(start:Point, end:Point, mask:ObjectType, result:RayHitInfo):BooleanCast a ray and (optionally) return information about what it hits in result.
Parameters
start:Point | |
end:Point | |
mask:ObjectType | |
result:RayHitInfo |
Boolean |
| getObjectsUnderPoint | () | method |
public function getObjectsUnderPoint(worldPosition:Point, results:Array, mask:ObjectType = null):BooleanReturn all the spatial objects under a given point. Objects can optionally implement pixel-level collision checking.
Parameters
worldPosition:Point — Point in worldspace to check.
| |
results:Array — An array into which ISpatialObject2Ds are added based on what is under point.
| |
mask:ObjectType (default = null) — Only consider objects that match this ObjectType. Null uses all types.
|
Boolean — Found something under point or not.
|
| queryCircle | () | method |
public function queryCircle(center:Point, radius:Number, mask:ObjectType, results:Array):BooleanReturn all the spatial objects that overlap the specified circle.
Parameters
center:Point | |
radius:Number | |
mask:ObjectType | |
results:Array |
Boolean |
| queryRectangle | () | method |
public function queryRectangle(box:Rectangle, mask:ObjectType, results:Array):BooleanReturn all the spatial objects that overlap with the specified box and match one or more of the types in the mask.
Note that if you pass in a populated array, this method appends to it. This can be useful if you want to combine the results of several queries. If you just want the results from one query, make sure to set results.length=0; before you pass it to queryRectangle.
Parameters
box:Rectangle | |
mask:ObjectType | |
results:Array |
Boolean — True if one or more objects were found and push()'ed to results.
|
| removeSpatialObject | () | method |
public function removeSpatialObject(object:ISpatialObject2D):voidRemove a previously registered object from this manager.
Parameters
object:ISpatialObject2D |
| EntitiesDirtyEvent | Constant |
public static const EntitiesDirtyEvent:String = BasicSpatialManager2D.EntitiesDirtyAn event with this name is raised on the owner.eventDispatcher when the entity list changes via addSpatialObject or removeSpatialObject.