void PhysicsWorld::createIslands() dirty contactPairIndex crash
darktemplar216 opened this issue · 4 comments
in void PhysicsWorld::createIslands()
const uint32 nbBodyContactPairs = static_cast<uint32>(mRigidBodyComponents.mContactPairs[bodyToVisitIndex].size());
for (uint32 p=0; p < nbBodyContactPairs; p++) {
const uint32 contactPairIndex = mRigidBodyComponents.mContactPairs[bodyToVisitIndex][p];
ContactPair& pair = (*mCollisionDetection.mCurrentContactPairs)[contactPairIndex];
When using Trigger and RigidBody together, sometimes mRigidBodyComponents.mContactPairs contain dirty indices from the old frames and indexing mCollisionDetection.mCurrentContactPairs crashes the program by hitting the Assertion inside Array.
Seems that only cleaning the Enabled RigidBodyComponents leaves the dirty data behind
const uint32 nbRigidBodyEnabledComponents = mRigidBodyComponents.getNbEnabledComponents();
for (uint32 b=0; b < nbRigidBodyEnabledComponents; b++) {
mRigidBodyComponents.mContactPairs[b].clear();
}
I change this loop to all rigidbodyComponents
for (uint32 b = 0; b < nbRigidBodyComponents; b++) {
mRigidBodyComponents.mContactPairs[b].clear();
}
seems everything's fine and prevented the crash.
Does it makes any sense to you? Daniel.
Thanks a lot for reporting this. I will take a look at this as soon as I have some time.
Thanks, dude, nobody knows this lib better than you. Thumbs up
This issue is already fixed by some refactoring I did in the 'develop' branch. This will be part of the next release of the library. Again, thanks a lot for reporting the issue and for the fix also.
This is now fixed in version v0.10.0 of the library. Thanks a lot for reporting the issue.