PackageBox2D.Collision
Interfacepublic interface IBroadPhase
Implementorsb2DynamicTreeBroadPhase
SourceIBroadPhase.as

Interface for objects tracking overlap of many AABBs.



Public Methods
 MethodDefined by
  
CreateProxy(aabb:b2AABB, userData:*):*
Create a proxy with an initial AABB.
IBroadPhase
  
DestroyProxy(proxy:*):void
Destroy a proxy.
IBroadPhase
  
GetFatAABB(proxy:*):b2AABB
Get the fat AABB for a proxy.
IBroadPhase
  
Get the number of proxies.
IBroadPhase
  
GetUserData(proxy:*):*
Get user data from a proxy.
IBroadPhase
  
MoveProxy(proxy:*, aabb:b2AABB, displacement:b2Vec2):void
Call MoveProxy as many times as you like, then when you are done call UpdatePairs to finalized the proxy pairs (for your time step).
IBroadPhase
  
Query(callback:Function, aabb:b2AABB):void
Query an AABB for overlapping proxies.
IBroadPhase
  
RayCast(callback:Function, input:b2RayCastInput):void
Ray-cast agains the proxies in the tree.
IBroadPhase
  
Rebalance(iterations:int):void
Give the broadphase a chance for structural optimizations
IBroadPhase
  
TestOverlap(proxyA:*, proxyB:*):Boolean
IBroadPhase
  
UpdatePairs(callback:Function):void
Update the pairs.
IBroadPhase
  
Validate():void
For debugging, throws in invariants have been broken
IBroadPhase
Method detail
CreateProxy()method
public function CreateProxy(aabb:b2AABB, userData:*):*

Create a proxy with an initial AABB. Pairs are not reported until UpdatePairs is called.

Parameters
aabb:b2AABB
 
userData:*

Returns
*
DestroyProxy()method 
public function DestroyProxy(proxy:*):void

Destroy a proxy. It is up to the client to remove any pairs.

Parameters
proxy:*
GetFatAABB()method 
public function GetFatAABB(proxy:*):b2AABB

Get the fat AABB for a proxy.

Parameters
proxy:*

Returns
b2AABB
GetProxyCount()method 
public function GetProxyCount():int

Get the number of proxies.

Returns
int
GetUserData()method 
public function GetUserData(proxy:*):*

Get user data from a proxy. Returns null if the proxy is invalid.

Parameters
proxy:*

Returns
*
MoveProxy()method 
public function MoveProxy(proxy:*, aabb:b2AABB, displacement:b2Vec2):void

Call MoveProxy as many times as you like, then when you are done call UpdatePairs to finalized the proxy pairs (for your time step).

Parameters
proxy:*
 
aabb:b2AABB
 
displacement:b2Vec2
Query()method 
public function Query(callback:Function, aabb:b2AABB):void

Query an AABB for overlapping proxies. The callback class is called with each proxy that overlaps the supplied AABB, and return a Boolean indicating if the broaphase should proceed to the next match.

Parameters
callback:Function — This function should be a function matching signature function Callback(proxy::Boolean
 
aabb:b2AABB
RayCast()method 
public function RayCast(callback:Function, input:b2RayCastInput):void

Ray-cast agains the proxies in the tree. This relies on the callback to perform exact ray-cast in the case where the proxy contains a shape The callback also performs any collision filtering

Parameters
callback:Function — This function should be a function matching signature function Callback(subInput:b2RayCastInput, proxy::Number Where the returned number is the new value for maxFraction
 
input:b2RayCastInput
Rebalance()method 
public function Rebalance(iterations:int):void

Give the broadphase a chance for structural optimizations

Parameters
iterations:int
TestOverlap()method 
public function TestOverlap(proxyA:*, proxyB:*):BooleanParameters
proxyA:*
 
proxyB:*

Returns
Boolean
UpdatePairs()method 
public function UpdatePairs(callback:Function):void

Update the pairs. This results in pair callbacks. This can only add pairs.

Parameters
callback:Function
Validate()method 
public function Validate():void

For debugging, throws in invariants have been broken