Minor complaint

Took me a little while to figure out that to implement the Contact Listener one has to do b2World::SetContactListener().

It's really not a big deal at all, but the documentation failed to mention it in the "Contact Listener" section and I thought that this particular bit of information is more important than the rest of the section.

While I'm at it, a legitimate question:

Since b2ContactResult has more information that is useful for me, i.e. tangent impulse and normal impulse, what are the disadvantages of using the Result callback as opposed to Add?
Add is before the position and velocity solver, so other information is available in the world state. You'd need to use that, e.g. if you wanted a player to pick up a powerup without bouncing off it, without declaring the powerup a sensor.
BorisTheBrave wrote:
Add is before the position and velocity solver, so other information is available in the world state. You'd need to use that, e.g. if you wanted a player to pick up a powerup without bouncing off it, without declaring the powerup a sensor.


ah, gotcha. is there a way to modify the impulse so that it'll still bounce, but with less force? I'm trying to dynamically break things so some extra kinetic energy should be lost.
dc443 wrote:
is there a way to modify the impulse so that it'll still bounce, but with less force? I'm trying to dynamically break things so some extra kinetic energy should be lost.

That sounds more like a job for restitution than anything else.

But in any case, using Add or Result are just event hooks, you have to put in some code yourself for the result you want. I wouldn't know which one is easier to work with for this particular case, though be warned, there are restrictions on changes you can make to the world at certain times. I forget what the exact requirements are, but I think they are asserted upon.
Yeah, I have to buffer any changes I plan to make and handle them after the timestep. (and even then, only want to modify each body once since there may be multiple events for each body)

Original thread: https://box2d.org/forum/viewtopic.php?t=1076