schteppe / p2.js

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

impact vs. beginContact #201

Closed gaufqwi closed 8 years ago

gaufqwi commented 8 years ago

This is really a usage question not an issue, but I couldn't find a more appropriate place to ask.

What is the difference between the beginContact event and the impact event?

schteppe commented 8 years ago

The biggest difference is that the beginContact event is run before constraint solve and body integration. In other words: the beginContact event can be used to disable contacts before they are solved.

It also looks like impact event will run once per contact point, and the beginContact once per shape pair.

The begin/endContact events makes the impact event superfluous to me. Should probably be deprecated.

gaufqwi commented 8 years ago

Thank you.

Is there a better place to ask usage questions like this? I hate to clutter up the issues database.

schteppe commented 8 years ago

No problemo :)

I think, this is the best (and only?) place to ask for now. Maybe you could ask in http://html5gamedevs.com forum too but that is more aimed towards different gamedev frameworks.

schteppe commented 8 years ago

Deprecated it here: https://github.com/schteppe/p2.js/commit/605e61042e34794e6fb48b8d8f2f48e3631cdb46#diff-cac728b68c876a87af597924712ea409R219