schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 330 forks source link

World dispatching 'beginContact' multiple times #265

Open ghost opened 7 years ago

ghost commented 7 years ago

I have a dynamic body (circle) and when it passes through a static sensor (rectangle) it dispatches 'beginContact' and 'endContact' multiple times while the bodies are still overlapping each other.

ironchestgames commented 7 years ago

Bump.

I have seen this too (kind of). I'm trying to replicate this in a simple example, but no luck so far. So it could easily be me just messing something up. I only see this in a bit more complex setup (my game has a ninja rope/distance constraint and a sensor on the bottom of my avatar to know if it's standing or not, but the sensor fires contact events badly. End-contact events when not yet ended, and begin-contact events sometime fires like a second too late.)

I'm using p2 0.7.1 from npm.

Kind Regards,

EDIT: Unbump, here's why https://github.com/schteppe/p2.js/issues/279

rogerscg commented 5 years ago

Bump. Calling world narrowphase.bodiesOverlap provides an incorrect value.