In b2Shape, there is an array of vertices, which are part of that shape. Why not change it to a pointer, and when the shape is created, allocate an array, only big enough to hold the number of vertices that are in it?
For example:
b2Vec2 m_vertices[b2_maxPolygonVertices];
Would go to:
b2Vec2* m_vertices;
And then, when the shape is created from a shape def:
m_vertices = new b2Vec2[m_vertexCount];
This would save memory, and put virtually no restriction on the number of vertices. 🙂
For example:
b2Vec2 m_vertices[b2_maxPolygonVertices];
Would go to:
b2Vec2* m_vertices;
And then, when the shape is created from a shape def:
m_vertices = new b2Vec2[m_vertexCount];
This would save memory, and put virtually no restriction on the number of vertices. 🙂