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 🙂

Screen shot 2010-07-14 at 6.47.38 PM.png [ 31.1 KiB | Viewed 460 times ]
Test bed Code:
Attachment:
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
#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
