Aborting due to Chipmunk error: Internal Error: Dangling contact graph pointers detected. (A)
Failed condition: cpArbiterThreadForBody(arb, body)->next == NULL
Source:..\..\External\Chipmunk\Chipmunk\src\cpSpaceComponent.c:176
It only happens when I put a body to sleep and another body collides with the sleeping body. I'm using cpBodySleep because I want to add all of my objects into the world in a sleeping state. Below is a sample that reproduces the problem for me in Chipmunk 6.2.1.
Code: Select all
void SleepTest()
{
cpSpace* space = cpSpaceNew();
const float mass = 10.0f;
const float radius = 1.0f;
cpBody* body1 = cpBodyNew(mass, cpMomentForCircle(mass, 0.0f, radius, cpvzero));
cpShape* shape1 = cpCircleShapeNew(body1, radius, cpvzero);
cpBody* body2 = cpBodyNew(mass, cpMomentForCircle(mass, 0.0f, radius, cpvzero));
cpShape* shape2 = cpCircleShapeNew(body2, radius, cpvzero);
cpBodySetPos(body1, cpv(5.0f, 0.0f));
cpSpaceAddBody(space, body1);
cpSpaceAddShape(space, shape1);
cpBodySleep(body1);
cpBodySetPos(body2, cpv(0.0f, 0.0f));
cpSpaceAddBody(space, body2);
cpSpaceAddShape(space, shape2);
cpBodySleep(body2);
cpBodySetVel(body1, cpv(-5.0f, 0.0f));
const float dt = 1.0f / 30.0f;
float simTime = 0.0f;
while (simTime < 5.0f)
{
cpSpaceStep(space, dt);
simTime += dt;
}
cpSpaceRemoveShape(space, shape1);
cpSpaceRemoveBody(space, body1);
cpShapeFree(shape1);
cpBodyFree(body1);
cpSpaceRemoveShape(space, shape2);
cpSpaceRemoveBody(space, body2);
cpShapeFree(shape2);
cpBodyFree(body2);
cpSpaceFree(space);
}