cchipmunk

How can I free chipmunks space?


I am using chipmunk as a physics engine in my game. The problem is I now want to free all the children and then the space itself, so I can create a new space for the new level. I tried this:

cpSpaceFreeChildren(space);
cpSpaceFree(space);

But it does not work and fails in:

 cpHashSetReject(cpHashSet *set, cpHashSetRejectFunc func, void *data)
 {
   // Iterate over all the chains.
   for(int i=0; i<set->size; i++){ <-- here

Is there anything I need to clean up before calling this two methods?


Solution

  • I forgot to unschedule my tick: function that calls cpstep before freeing the space... It is working now.