Chipmunk 7. anyway to remove a collision handler?

Discuss new features and future development.
Post Reply
davecazz
Posts: 1
Joined: Fri Mar 27, 2015 5:00 pm
Contact:

Chipmunk 7. anyway to remove a collision handler?

Post 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.
volte
Posts: 5
Joined: Wed Jun 01, 2011 11:14 pm
Contact:

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

Post 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.
rrakkola
Posts: 9
Joined: Thu Jun 27, 2013 3:04 pm
Contact:

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

Post by rrakkola »

I would also like to know what is the current way to do this if any?
p1p1
Posts: 7
Joined: Sun Jul 19, 2015 7:17 am
Contact:

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

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests