Вы должны убедиться, что форма была добавлена как статическая или нет, может быть, этот код немного поможет:
if(shape != NULL)
{
int isStatic = 1;
cpBody *bd = cpShapeGetBody(shape);
if(bd != NULL)
{
if(!cpBodyIsRogue(bd) && !cpBodyIsStatic(bd)) //second condition is just to make sure
{
isStatic = 0;
cpSpace *sp1 = cpBodyGetSpace(bd);
if(sp1 != NULL)
{
cpSpaceRemoveBody(sp1, bd); //remove body from space and then free it
}
}
cpBodyFree(bd);
}
cpSpace *sp = cpShapeGetSpace(shape);
if(sp != NULL)
{
if(isStatic)
cpSpaceRemoveStaticShape(sp, shape);
else
cpSpaceRemoveShape(sp, shape); //remove shape from space and then free it
}
cpShapeFree(shape);
shape = NULL;
}