PackageBox2D.Collision
Classpublic class b2DynamicTreeBroadPhase
ImplementsIBroadPhase
Sourceb2DynamicTreeBroadPhase.as

The broad-phase is used for computing pairs and performing volume queries and ray casts. This broad-phase does not persist pairs. Instead, this reports potentially new pairs. It is up to the client to consume the new pairs and to track subsequent overlap.



Public Methods
 MethodDefined by
  
CreateProxy(aabb:b2AABB, userData:*):*
Create a proxy with an initial AABB.
b2DynamicTreeBroadPhase
  
DestroyProxy(proxy:*):void
Destroy a proxy.
b2DynamicTreeBroadPhase
  
GetFatAABB(proxy:*):b2AABB
Get the AABB for a proxy.
b2DynamicTreeBroadPhase
  
Get the number of proxies.
b2DynamicTreeBroadPhase
  
GetUserData(proxy:*):*
Get user data from a proxy.
b2DynamicTreeBroadPhase
  
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).
b2DynamicTreeBroadPhase
  
Query(callback:Function, aabb:b2AABB):void
Query an AABB for overlapping proxies.
b2DynamicTreeBroadPhase
  
RayCast(callback:Function, input:b2RayCastInput):void
Ray-cast agains the proxies in the tree.
b2DynamicTreeBroadPhase
  
Rebalance(iterations:int):void
b2DynamicTreeBroadPhase
  
TestOverlap(proxyA:*, proxyB:*):Boolean
b2DynamicTreeBroadPhase
  
UpdatePairs(callback:Function):void
Update the pairs.
b2DynamicTreeBroadPhase
  
Validate():void
b2DynamicTreeBroadPhase
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 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):voidParameters
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