// Buffer a pair for removal.
public void RemoveBufferedPair(int id1, int id2)
{
Box2DXDebug.Assert(id1 != PairManager.NullProxy && id2 != PairManager.NullProxy);
Box2DXDebug.Assert(_pairBufferCount < Settings.MaxPairs);
Pair pair = Find(id1, id2);
if (pair == null)
{
// The pair never existed. This is legal (due to collision filtering).
return;
}
// If this pair is not in the pair buffer ...
if (pair.IsBuffered() == false)
{
// This must be an old pair.
Box2DXDebug.Assert(pair.IsFinal() == true);
pair.SetBuffered();
_pairBuffer[_pairBufferCount].ProxyId1 = pair.ProxyId1;
_pairBuffer[_pairBufferCount].ProxyId2 = pair.ProxyId2;
++_pairBufferCount;
Box2DXDebug.Assert(_pairBufferCount <= _pairCount);
}
pair.SetRemoved();
if (BroadPhase.IsValidate)
{
ValidateBuffer();
}
}