josephg / Chipmunk-js

Port of slembcke/Chipmunk-Physics to Javascript
http://dl.dropbox.com/u/2494815/demo/Joints.html
536 stars 59 forks source link

Fix: Space.removeShape trashing arbiter list. #27

Closed LaercioAsano closed 10 years ago

LaercioAsano commented 10 years ago

When a collision is ignored (returning false on the begin callback), the related arbiter doesn't make into the arbiter list of the body. But when the shape is removed, the space tries to unthread this ignored arbiter off the body arbiter list, trashing it. I'm not sure if this is a good solution because I could'nt really grasp all the code. But this seems to work for me.

josephg commented 10 years ago

Hm - I wonder if this problem happens in the upstream code. @slembcke - does this look right to you?

LaercioAsano commented 10 years ago

Looking on upstream didn't occur to me...

I would say it won't happen on upstream because of line 34 of: https://github.com/slembcke/Chipmunk2D/blob/master/src/cpArbiter.c

If compared to js, line 234 on https://github.com/josephg/Chipmunk-js/blob/master/lib/cpArbiter.js

There is one condition less...

LaercioAsano commented 10 years ago

Maybe this way is better.

josephg commented 10 years ago

Yeah lets roll with that. I'd rather stay in sync as much as we can - its much easier in the long run.