Valid TestBed -> Box2d Infinite Loops (test bed provided)

This test bed hangs Box2D. It's a dynamic box fit perfectly between two long, thin static boxes. It crashes if the coordinates are just right - the height / width of the dynamic box is exactly the distance between the static ones. I started it a couple minutes ago and it's still taking 99% of my cpu 🙂

Attachment:
Screen shot 2010-07-14 at 6.47.38 PM.png
Screen shot 2010-07-14 at 6.47.38 PM.png [ 31.1 KiB | Viewed 460 times ]


Test bed Code:

Code:
#ifndef SQUISH_H
#define SQUISH_H

class Squish : public Test
{
public:
   Squish()
   {
      {
         b2BodyDef bd;
         b2Body* ground = m_world->CreateBody(&bd);

         b2PolygonShape shape;
         shape.SetAsEdge(b2Vec2(-40.0f, 0.0f), b2Vec2(40.0f, 0.0f));
         ground->CreateFixture(&shape, 0.0f);
      }
      
      {
         b2Body* b;
         b2BodyDef bd;
         b2PolygonShape ps;
         
         ps.SetAsBox(100.0f, 0.5f);
         
         bd.position.Set(0, 20.0f);
         b = m_world->CreateBody(&bd);
         b->CreateFixture(&ps, 0.0f);
         
         bd.position.Set(0, 30.0f);
         b = m_world->CreateBody(&bd);
         b->CreateFixture(&ps, 0.0f);
         
         ps.SetAsBox(4.5f, 4.5f);
         bd.type = b2_dynamicBody;
         b = m_world->CreateBody(&bd);
         b->CreateFixture(&ps, 1.0f);
         
      }
   }

   static Test* Create()
   {
      return new Squish;
   }
};

#endif
Yes, I need to limit the number of time of impact events a single contact can have in a time step. Please file an issue and link to this forum topic:

http://code.google.com/p/box2d/issues/list
Issue Posted. Thanks for the explanation!

http://code.google.com/p/box2d/issues/detail?id=143
Having the same problem when manually moving a Static Body,

Image

What is a good (safe) number to break out of the contact TOI loop until a fix is released?
Breaking out after 10 iterations should be fine in most cases.
Spooky, I put 10 in while awaiting your answer.

Thanks Erin
Erin, would the correct loop to limit be the one that begins ~ line 540 on b2World.cpp?

Code:
   // Find TOI events and solve them.
   for (;;)
   {
      // Find the first TOI.
      b2Contact* minContact = NULL;
mayobutter wrote:
Erin, would the correct loop to limit be the one that begins ~ line 540 on b2World.cpp?

Code:
   // Find TOI events and solve them.
   for (;;)
   {
      // Find the first TOI.
      b2Contact* minContact = NULL;


Correct.

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