Page 1 of 1

Chipmunk 7. anyway to remove a collision handler?

PostPosted: Mon Mar 30, 2015 5:16 pm
by davecazz
Currently trying to migrate to Chipmunk 7 because of 64 bit issues with submitting apps.

Running into an issue trying to migrate called to [ChipmunkSpace removeCollisionHandlerForTypeA: and b:]

as far as I can tell there is no way to remove a handler once it's been added, even in the underlying c class.

the ChipmunkSpace class has a _handlers array that keeps getting bigger with each add call.

looks like the cpSpace class has a hash set so you could theoretically set null functions to the handler but the only way you can reset the hash is to destroy the space.

Re: Chipmunk 7. anyway to remove a collision handler?

PostPosted: Sat May 23, 2015 1:48 pm
by volte
Bump. I'd like to know the answer to this too. I can't seem to figure it out. I'm gonna dig through the commits. I wish there was an upgrade guide from 6-7.

EDIT: Here is the commit that removes the cpSpaceRemoveCollisionHandler

The commit message simply says "A cleanup/comment pass" so I'm not sure what was behind this API change. I'll keep digging.

Re: Chipmunk 7. anyway to remove a collision handler?

PostPosted: Thu Jul 30, 2015 8:04 am
by rrakkola
I would also like to know what is the current way to do this if any?

Re: Chipmunk 7. anyway to remove a collision handler?

PostPosted: Thu Jul 30, 2015 11:35 am
by p1p1
Don't add the body's shape to the cpSpace. Only add bodies, but not shapes. You'll get all the same physics with gravity, etc, but without collisions. Your bodies will jut fly through each other.