First, sorry for my English, im not an American. My question is how can I remove the shape and body from the space, this isn't related with collision detection. Im triying to do this with a touch event, specifically I'm trying to clear a ball Touching it (I have a lot of balls in the space), but I have no idea how to do it, I have been looking on Internet and cannot find any help regarding how to do it, all relates to the collisions and that's not what I need.
I read many times the documentation, but not contain any useful information how to do this. Only have how delete with colission. I know how delete with colission:
static void postStepRemove (cpSpace *space, cpShape *shape, void *data) {
//Remove the shape and body
cpSpaceRemoveBody(space, shape->body);
cpBodyFree(shape->body);
cpSpaceRemoveShape(space, shape);
cpShapeFree(shape);
}
static int collission(cpArbiter *arb, cpSpace *space, void *data){
cpShape *a, *b;
cpArbiterGetShapes(arb, &a, &b);
cpSpaceAddPostStepCallback(space, (cpPostStepFunc)postStepRemove, a, nil);
cpSpaceAddPostStepCallback(space, (cpPostStepFunc)postStepRemove, b, nil);
return 0;
}
return 1;
}
I use this with collision, but I need some example without collision.