5
Vote

RemoveOverlappingPairsContainingProxy, bug

description

In C# version, OverlappingPairChache.cs : RemoveOverlappingPairsContainingProxy(), you are iterating through the _overlappingPairs collection in reverse order. However, when you remove one, you then increment the 'i' counter. This is not needed when going in reverse order. If you were removing items going in order, then you would need to decrement the counter after removing one so you don't skip an element. By doing what you are doing, you will be testing an element twice if the one before it is removed, and cause an exception in other cases.
 
When there is only one item in the _overlappingPairs array, this causes an exception. You can see this by adding two dynamic RigidBodies at the same location, and then removing the second one.

comments