PackageBox2D.Collision
Classpublic class b2PairManager



Public Methods
 MethodDefined by
  
b2PairManager
  
AddBufferedPair(proxyId1:int, proxyId2:int):void
As proxies are created and moved, many pairs are created and destroyed.
b2PairManager
  
Commit():void
b2PairManager
  
Equals(pair:b2Pair, proxyId1:uint, proxyId2:uint):Boolean
[static]
b2PairManager
  
[static]
b2PairManager
  
Hash(proxyId1:uint, proxyId2:uint):uint
[static] static Thomas Wang's hash, see: http://www.concentric.net/~Ttwang/tech/inthash.htm
b2PairManager
  
Initialize(broadPhase:b2BroadPhase, callback:b2PairCallback):void
b2PairManager
  
RemoveBufferedPair(proxyId1:int, proxyId2:int):void
Buffer a pair for removal.
b2PairManager
Property detail
m_hashTableproperty
b2internal var m_hashTable:Array
m_pairCountproperty 
b2internal var m_pairCount:int
m_pairsproperty 
b2internal var m_pairs:Array
Constructor detail
b2PairManager()constructor
public function b2PairManager()
Method detail
AddBufferedPair()method
public function AddBufferedPair(proxyId1:int, proxyId2:int):void

As proxies are created and moved, many pairs are created and destroyed. Even worse, the same pair may be added and removed multiple times in a single time step of the physics engine. To reduce traffic in the pair manager, we try to avoid destroying pairs in the pair manager until the end of the physics step. This is done by buffering all the RemovePair requests. AddPair requests are processed immediately because we need the hash table entry for quick lookup. All user user callbacks are delayed until the buffered pairs are confirmed in Commit. This is very important because the user callbacks may be very expensive and client logic may be harmed if pairs are added and removed within the same time step. Buffer a pair for addition. We may add a pair that is not in the pair manager or pair buffer. We may add a pair that is already in the pair manager and pair buffer. If the added pair is not a new pair, then it must be in the pair buffer (because RemovePair was called).

Parameters
proxyId1:int
 
proxyId2:int
Commit()method 
public function Commit():void
Equals()method 
public static function Equals(pair:b2Pair, proxyId1:uint, proxyId2:uint):BooleanParameters
pair:b2Pair
 
proxyId1:uint
 
proxyId2:uint

Returns
Boolean
EqualsPair()method 
public static function EqualsPair(pair1:b2BufferedPair, pair2:b2BufferedPair):BooleanParameters
pair1:b2BufferedPair
 
pair2:b2BufferedPair

Returns
Boolean
Hash()method 
public static function Hash(proxyId1:uint, proxyId2:uint):uint

static Thomas Wang's hash, see: http://www.concentric.net/~Ttwang/tech/inthash.htm

Parameters
proxyId1:uint
 
proxyId2:uint

Returns
uint
Initialize()method 
public function Initialize(broadPhase:b2BroadPhase, callback:b2PairCallback):voidParameters
broadPhase:b2BroadPhase
 
callback:b2PairCallback
RemoveBufferedPair()method 
public function RemoveBufferedPair(proxyId1:int, proxyId2:int):void

Buffer a pair for removal.

Parameters
proxyId1:int
 
proxyId2:int