updatePairs method
Update the pairs. This results in pair callbacks. This can only add pairs.
Implementation
@override
void updatePairs(PairCallback callback) {
// Reset pair buffer
_pairBuffer.clear();
// Perform tree queries for all moving proxies.
for (final proxyId in _moveBuffer) {
_queryProxyId = proxyId;
if (proxyId == BroadPhase.nullProxy) {
continue;
}
// We have to query the tree with the fat AABB so that
// we don't fail to create a pair that may touch later.
final fatAABB = _tree.fatAABB(proxyId);
// Query tree, create pairs and add them pair buffer.
_tree.query(this, fatAABB);
}
// Reset move buffer
_moveBuffer.clear();
// Send the pairs back to the client.
for (final pair in _pairBuffer) {
final userDataA = _tree.userData(pair.proxyIdA);
final userDataB = _tree.userData(pair.proxyIdB);
callback.addPair(userDataA, userDataB);
}
}