Recently I've been noticing a lot of pop up errors from box2d.
I determined that some were related to drawing polygons wrong (as in not listing the coordinates in a counter clockwise fashion).
but I still frequently get this:
205 // Create core polygon shape by shifting edges inward.
206 // Also compute the min/max radius for CCD.
207 for (int32 i = 0; i < m_vertexCount; ++i)
208 {
209 int32 i1 = i - 1 >= 0 ? i - 1 : m_vertexCount - 1;
210 int32 i2 = i;
211
212 b2Vec2 n1 = m_normals[i1];
213 b2Vec2 n2 = m_normals[i2];
214 b2Vec2 v = m_vertices[i] - m_centroid;;
215
216 b2Vec2 d;
217 d.x = b2Dot(n1, v) - b2_toiSlop;
218 d.y = b2Dot(n2, v) - b2_toiSlop;
219
220 // Shifting the edge inward by b2_toiSlop should
221 // not cause the plane to pass the centroid.
222
223 // Your shape has a radius/extent less than b2_toiSlop.
224 b2Assert(d.x >= 0.0f);
225 b2Assert(d.y >= 0.0f);
226 b2Mat22 A;
227 A.col1.x = n1.x; A.col2.x = n1.y;
228 A.col1.y = n2.x; A.col2.y = n2.y;
229 m_coreVertices[i] = A.Solve(d) + m_centroid;
230 }
231 }
I don't really understand whats going on here but my code that causes the problem generates triangles to fill in spaces.
Also on occasion I'm getting crashes that are attributed to random modules, not really sure whats causing them, but I wonder if it might be related.
It basically means your objects are too small. Keep in mind that in 0.6.0 a physics unit equals 60 pixels by default. (IIRC) So, anything passed to the physics engine is 1/60th the size of what it was in 0.5.0.
OK, I thought it might be something like that, I guess I'll just have to add something to avoid making extremely thin shapes. And I guess changing the scale would help out, since I never had any issues in 0.5.0.
According to the Box2D manual: "Keep the size of moving objects roughly between 0.1 and 10 meters."
world:getMeter() tells me 30
so I take it I should :setMeter() to the smallest value I can without me making moving objects over 10 meters (which will probably be about 10-15)
Well having gotten that sorted, I've found that I get random crashes that are in some way related to destroy().
by removing that line and just writing over the old shapes my random crashes disappear, but after a while I get another box2d error message saying something about pair counts.
Refers to this: