Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

void PhysicsWorld::createIslands() dirty contactPairIndex crash #366

Closed
darktemplar216 opened this issue Jan 2, 2024 · 4 comments
Closed
Assignees
Labels

Comments

@darktemplar216
Copy link

darktemplar216 commented Jan 2, 2024

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.

@DanielChappuis
Copy link
Owner

Thanks a lot for reporting this. I will take a look at this as soon as I have some time.

@DanielChappuis DanielChappuis self-assigned this Jan 4, 2024
@DanielChappuis DanielChappuis added this to the Release v1.0.0 milestone Jan 4, 2024
@darktemplar216
Copy link
Author

Thanks, dude, nobody knows this lib better than you. Thumbs up

@DanielChappuis
Copy link
Owner

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.

@DanielChappuis
Copy link
Owner

This is now fixed in version v0.10.0 of the library. Thanks a lot for reporting the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants