How can I remove all chipmunk bodies from a space.
I mean, can we loop throw all of them?
thanks in advance
A fast, easy to use, free, and community supported 2D game engine
How can I remove all chipmunk bodies from a space.
I mean, can we loop throw all of them?
thanks in advance
any one
or we can loop throw all shapes?
Yes you can loop through them, I've not heard of a "remove all bodies" method.
@cocosboy,
cpSpaceFreeChildren will remove everything in the space. Read the chipmunk docs down in the section 'Memory Management Functions'.
-Mark
Thanks Mark that was really help full.
but if any one wants to know about looping throw all bodies in a space ...
code is here
cpArray *bodies = space->bodies;
for(int i=0; i<bodies->num; i++)
{
cpBody *tempBody = (cpBody *)bodies->arr[i];
//do stuff with tempBody
}You must log in to post.