cannon.js: Collision exit event
We can detect collisions using…
body.addEventListener('collide', onCollide);
…Is there a way to detect when a collision exits?
body.addEventListener('collideExit', onCollideExit);
About this issue
- Original URL
- State: open
- Created 9 years ago
- Comments: 15 (7 by maintainers)
That would be nice to have, but it’s not currently implemented. In p2.js I’ve implemented the
beginContact
andendContact
events, which should be quite easy to remake in cannon.js. The contact tracking should be refactored though, right now it’s a bit messy…If you want to track if two bodies are in contact, run through the
world.contacts
array.These are available. You listen to the events on the world.
Note: Have only verified this on the maintained fork that is cannon-es https://github.com/pmndrs/cannon-es
I can’t seem to find this anywhere in the latest build… is there a
collideExit
event?