Box2D Freeze / Hang

Hi,

I'm having the same problem described on this post. It seems something goes wrong inside the ComputeTOI function. This is the error I get:

Quote:
Error: Error #1502: A script has executed for longer than the default timeout period
at Box2D.Common.Math::b2Math$/Dot()
at Box2D.Common.Math::b2Math$/MulTMV()
at b2SeparationFunction/Evaluate()
at Box2D.Collision::b2TimeOfImpact$/TimeOfImpact()
at Box2D.Dynamics.Contacts::b2Contact/http://www.box2d.org/ns/b2internal::ComputeTOI()
at Box2D.Dynamics::b2World/http://www.box2d.org/ns/b2internal::SolveTOI()
at Box2D.Dynamics::b2World/Step()


I've noticed that some properties inside bA.m_sweep and bB.m_sweep are NaN, in particular the variable Number a and the b2Vec2 c ( its x and y are NaN ).

In my program I'm shooting some dynamic bodies towards a static body made up of different fixtures with different shapes. When I have a contact between the dynamic body and the fixture of the static body I flag the hitten fixture so it can be removed from the static body in the next cycle.

I can't reproduce the freeze, but I get this Error #1502 almost once out of 10 I run the program.

Do you know any solution to solve this or to find a hack to at least avoid the freeze?

Many Thanks.
Hi,

First of all sorry my english, im from spain, 😀

I have the same problem as you describe. After two hours walking arround my application, rereading my code a lot of times, and having allways a freze after exactly 539 frames, I tried to use the "Profile" of flash builder, and I think this problem maybe related to some object is destroyed by garbage collector incorrectly. Then I remember the Listener:

addEventListener(Event.ENTER_FRAME, updateSimulation, false, 0, true);

Why we use a weak reference????????? We dont need it, we can remove the listener manually if we want, isnt it?

I change it to:

addEventListener(Event.ENTER_FRAME, updateSimulation, false, 0, false);
or
addEventListener(Event.ENTER_FRAME, updateSimulation); (it's the same)

IT'S WORKS!!!!!! and IT'S SO SIMPLE!!! AND I'M SO HAPPY!!!

And I hope my first post can help anyone. 😀

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