Hey,
I'm trying to experiment with 2D physics engines in C++. So far, it seems the most popular is Box2D. Unfortunately, Box2D is a rigid body physics engine and that's not really going to help me with what I want to try.
I want to be able to define a shape which has a number of vertices joined by springs, such that when this shape collides with rigid or other non-rigid shapes its shape will be flexible.
Now I've tried to think of ways of doing this in Box2D using only rigid bodies, but there always seems to be flaws:
- Use rectangles or line segments for the outer edges of the flexible shape. These will collide with other shapes. Unfortunately, they are not springy, so the desired effect would not be seen.
- Each vertex of the shape could be a body with its own small circular shape. These bodies can then be joined together by springs. This would work great in terms of the deformation of the shape, but imagine if the shape landed on a rigid spike and the spike just passed between the vertices. Then the shape would become stuck on the spike.
So what is the best way to do this kind of physics in C++? Preferably without having to write an entire physics engine. Maybe I'm just missing a feature of Box2D. Maybe it's just not the right choice. Then what is the right choice?
Thanks very much.