I've got a big map (one big PNG image) and I want to define edges and create a box2d body based on where I want the player to collide. I've used VertexHelper to draw the shapes, but when I use this:
b2Vec2 verts[] = {
//I removed a bunch of vertices for brevity.
b2Vec2(-783.5f / PTM_RATIO, -122.0f / PTM_RATIO),
b2Vec2(-784.0f / PTM_RATIO, -97.5f / PTM_RATIO),
b2Vec2(-777.0f / PTM_RATIO, -95.0f / PTM_RATIO),
b2Vec2(798.0f / PTM_RATIO, -120.0f / PTM_RATIO)
};
groundBox.Set(verts, 17);
groundBody->CreateFixture(&groundBox, 0);
but box2d crashes when there's more than 8 vertices.
I don't want to use a tilemap, but what's the best way to make a "collision map" or box2d shape for this?
Thanks!