google / liquidfun

2D physics engine for games
http://google.github.io/liquidfun
4.68k stars 641 forks source link

b2_fixtureContactListenerParticle flag works incorrectly when specified not for all particles #98

Open Blttrr opened 5 years ago

Blttrr commented 5 years ago

If there are particles with b2_fixtureContactListenerParticle flag in the system, contact listener receives BeginContact callbacks for all particles - even for particles without this flag. This happens because NotifyBodyContactListenerPostContact method doesn't take b2_fixtureContactListenerParticle flag into account.

Even worse, for particles without b2_fixtureContactListenerParticle flag, BeginContact callback is being called multiple times per contact - filtering out old contacts doesn't work.

The same bug applies to b2_particleContactListenerParticle and NotifyContactListenerPostContact method.

Manamongods commented 2 years ago

This should fix it: https://github.com/google/liquidfun/pull/113