I am new to Box2d, and I have just learned that it does not support concave polygons. I have read to get around this problem, I should use 2 (or more) convex polygons and apply them to the same shape.
Unfortunately, I have looked for a hours for an example of how to do this, but cant find one that works. Heres my code:
b2PolygonShape spriteShape;
int num = 6;
b2Vec2 verts[] = {
b2Vec2(-32.5f / PTM_RATIO, 52.0f / PTM_RATIO),
b2Vec2(-60.0f / PTM_RATIO, 26.5f / PTM_RATIO),
b2Vec2(-58.5f / PTM_RATIO, 17.5f / PTM_RATIO),
b2Vec2(-34.5f / PTM_RATIO, 7.5f / PTM_RATIO),
b2Vec2(-11.0f / PTM_RATIO, 25.0f / PTM_RATIO),
b2Vec2(-17.5f / PTM_RATIO, 47.5f / PTM_RATIO)
};
spriteShape.Set(verts, num);
int num2 = 6;
b2Vec2 verts2[] = {
b2Vec2(-26.5f / PTM_RATIO, 1.0f / PTM_RATIO),
b2Vec2(-34.0f / PTM_RATIO, -13.5f / PTM_RATIO),
b2Vec2(-26.5f / PTM_RATIO, -32.0f / PTM_RATIO),
b2Vec2(0.5f / PTM_RATIO, -42.5f / PTM_RATIO),
b2Vec2(49.0f / PTM_RATIO, -40.5f / PTM_RATIO),
b2Vec2(49.5f / PTM_RATIO, -14.0f / PTM_RATIO)
};
spriteShape.Set(verts2, num2);
This simply overrides the first polygon with the second, instead of combining them. How can I combine them instead?