Hello
I have a problem with a b2Assert(m_I > 0.0f) assertion in SetMassFromShapes(). The problem seems to occur when I have small x values (lower than about -15). This minimal code causes the assertion:
As you can see, it's a CCW rectangle with width around 0.1 and height around 0.3. It's used as a segment in a chain, and those kinds of segments work all over the map except when the x values get small (as I said). I can design around this problem in my game, but it's still annoying and confusing. Anybody knows something about this?
I have a problem with a b2Assert(m_I > 0.0f) assertion in SetMassFromShapes(). The problem seems to occur when I have small x values (lower than about -15). This minimal code causes the assertion:
Code:
b2BodyDef bodyDef;
b2Body* body = world->CreateBody(&bodyDef);
b2PolygonDef shapeDef;
shapeDef.density = 1;
shapeDef.vertexCount = 4;
shapeDef.vertices[0].x = -36.989616f;
shapeDef.vertices[1].x = -36.897999f;
shapeDef.vertices[2].x = -36.693401f;
shapeDef.vertices[3].x = -36.785019f;
shapeDef.vertices[0].y = 18.751558f;
shapeDef.vertices[1].y = 18.698116f;
shapeDef.vertices[2].y = 19.048872f;
shapeDef.vertices[3].y = 19.102314f;
body->CreateShape(&shapeDef);
body->SetMassFromShapes();
b2Body* body = world->CreateBody(&bodyDef);
b2PolygonDef shapeDef;
shapeDef.density = 1;
shapeDef.vertexCount = 4;
shapeDef.vertices[0].x = -36.989616f;
shapeDef.vertices[1].x = -36.897999f;
shapeDef.vertices[2].x = -36.693401f;
shapeDef.vertices[3].x = -36.785019f;
shapeDef.vertices[0].y = 18.751558f;
shapeDef.vertices[1].y = 18.698116f;
shapeDef.vertices[2].y = 19.048872f;
shapeDef.vertices[3].y = 19.102314f;
body->CreateShape(&shapeDef);
body->SetMassFromShapes();
As you can see, it's a CCW rectangle with width around 0.1 and height around 0.3. It's used as a segment in a chain, and those kinds of segments work all over the map except when the x values get small (as I said). I can design around this problem in my game, but it's still annoying and confusing. Anybody knows something about this?