b2internal var m_hashTable:Array
b2internal var m_pairCount:int
b2internal var m_pairs:Array
public function b2PairManager()
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 |
public function Commit():void
public static function Equals(pair:b2Pair, proxyId1:uint, proxyId2:uint):Boolean
Parameters
| pair:b2Pair |
|
| proxyId1:uint |
|
| proxyId2:uint |
Returns
public static function EqualsPair(pair1:b2BufferedPair, pair2:b2BufferedPair):Boolean
Parameters
Returns
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
public function Initialize(broadPhase:b2BroadPhase, callback:b2PairCallback):void
Parameters
public function RemoveBufferedPair(proxyId1:int, proxyId2:int):void
Buffer a pair for removal.
Parameters
| proxyId1:int |
|
| proxyId2:int |