Hello,
I've come across a weird issue today. Someone on my team was making a level and got this message :
Here is the piece of code (Box2D 2.1.2, b2Body::ResetMassData) :
And a partial debugger data :
So after the substraction on m_I, it is negative and the assertion fails.
Here is also the dump of the only fixture present on the b2Body at this point :
I only feed triangles to Box2D which come out of a tesselator from complex polygons but this one really puzzled me. Usually, a lot of weird shapes are handled smoothly.
If anyone has any ideas on why this might happen? It would be great to avoid this particular crash. Thanks!
Remi Gillig.
I've come across a weird issue today. Someone on my team was making a level and got this message :
Quote:
Assertion failed: m_I > 0.0f, file .\Dynamics\b2Body.cpp, line 310
Here is the piece of code (Box2D 2.1.2, b2Body::ResetMassData) :
Code:
// Center the inertia about the center of mass.
m_I -= m_mass * b2Dot(center, center);
b2Assert(m_I > 0.0f);
m_invI = 1.0f / m_I;
m_I -= m_mass * b2Dot(center, center);
b2Assert(m_I > 0.0f);
m_invI = 1.0f / m_I;
And a partial debugger data :
Code:
m_mass 1.0704041 float
center {x=172.21519 y=442.90372 } b2Vec2
m_I 241719.42 float
dot 225821.78 float
m_mass * dot 241720.54984569550 double
center {x=172.21519 y=442.90372 } b2Vec2
m_I 241719.42 float
dot 225821.78 float
m_mass * dot 241720.54984569550 double
So after the substraction on m_I, it is negative and the assertion fails.
Here is also the dump of the only fixture present on the b2Body at this point :
Code:
+ m_centroid {x=172.21519 y=442.90372 } b2Vec2
- m_vertices 0x0020f170 {x=171.94000 y=440.90399 } b2Vec2 [8]
+ [0] {x=171.94000 y=440.90399 } b2Vec2
+ [1] {x=172.75999 y=444.30899 } b2Vec2
+ [2] {x=171.93500 y=443.49399 } b2Vec2
- m_vertices 0x0020f170 {x=171.94000 y=440.90399 } b2Vec2 [8]
+ [0] {x=171.94000 y=440.90399 } b2Vec2
+ [1] {x=172.75999 y=444.30899 } b2Vec2
+ [2] {x=171.93500 y=443.49399 } b2Vec2
I only feed triangles to Box2D which come out of a tesselator from complex polygons but this one really puzzled me. Usually, a lot of weird shapes are handled smoothly.
If anyone has any ideas on why this might happen? It would be great to avoid this particular crash. Thanks!
Remi Gillig.