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.
Chipmunk: How to remove shape and body?
(2 posts) (2 voices)-
Posted 1 year ago #
-
I can't help you with the touch detection problem. I think there was a method to check if there is a body at that (converted) position but I don't remember how, sorry.
If you have scheduled
cpSpaceStep()you should use SpaceManager and the functioncpSpaceAddPostStepCallback().This snippet shows how to remove shape (shape) and body (shape->body) from the space (space):
cpSpaceRemoveBody(space, shape->body); cpSpaceRemoveShape(space, shape); cpBodyFree(shape->body); cpShapeFree(shape);Be sure to use it with the above explained function otherwise you might get the error 'EXC_BAD_ACCESS'.
Posted 1 year ago #
Reply
You must log in to post.