Concave & Irregular Shapes

Hi I am new to this forum and making my first post.

I would like to know if it is possible to do concave or irregular curve shapes with SDL & Box2d?

My approach:
1) I have tried to dig through box2d to get the b2world to return me information about the contacts and computed results after collision occurred for 2 shapes.

2) Then alter or extend some codes from the box2d to link with my created class of irregular shapes using SDL's alpha channel to do a more in-depth collision detection.

3) Do the computation for the impact of the collision and then render.

Does anyone thinks there's a better way to do it? or other possible solutions?
Also, I also have trouble with digging and understanding contacts and the contactlistener to know if which object is being collided.

Thanks for anyone who replies me in advance! ^^
A single shape in Box2D cannot have concave angles, but a rigid body (b2Body) may contain more than one shape. Concave angles may be formed by two shapes that share an edge or overlap.
What about curved irregular shapes like this?

It is a shape that I really need to use in my game.
deadheat wrote:
What about curved irregular shapes like this?

It is a shape that I really need to use in my game.


You'll have to make that out of multiple shapes as it's concave.

Bill
There are some polygon decomposition tools floating around these forums that will break down complex concave polygons into a set of smaller convex polygon components. I haven't used them so I can't comment further on them, but I can say that increasing the complexity of the shape will necessarily increase the time it takes to simulate it, especially if it's a dynamic (moving) shape.

There are other physics engines out there that use something more like pixels/voxels/particles to represent physical shapes. They are agnostic to the complexity of shapes - only the size/resolution affects the simulation speed. These may be better suited to what you want to do.

Original thread: https://box2d.org/forum/viewtopic.php?t=1326