I have some code used for explosions that is called from the b2ContactListener's BeginContact function. The piece of this code that causes the physics simulation to jitter forever after this code is called is the following:
I ran a profiler on my app (I am using the IOS port of box2d) and found that when the jitter is present, a large amount of time is spent on b2PairLessThan(b2Pair const&, b2Pair const&); When the jitter isn't present, this function doesn't show up anywhere in the top cpu consuming functions. The jitter seems to be worse in maps with more static bodies than maps without as many static bodies. This has stumped me for a few days now. I can't seem to figure it out because of my limited knowledge about the workings of box2d. Any ideas on why this is happening would be appreciated.
Code:
b->ApplyLinearImpulse(b2Vec2(cosf(angle) * force, sinf(angle) * force), b->GetPosition());
I ran a profiler on my app (I am using the IOS port of box2d) and found that when the jitter is present, a large amount of time is spent on b2PairLessThan(b2Pair const&, b2Pair const&); When the jitter isn't present, this function doesn't show up anywhere in the top cpu consuming functions. The jitter seems to be worse in maps with more static bodies than maps without as many static bodies. This has stumped me for a few days now. I can't seem to figure it out because of my limited knowledge about the workings of box2d. Any ideas on why this is happening would be appreciated.