Curved shapes

Hello. I am funky3000, and I come from IncrediBots (a game with Box2D) and I have a question.

I am continuously hearing that Box2D does not support curved shapes other than perfect circles.

People in the new Ideas and Bug Reports forums have suggested these:

  • Circles with holes/cutouts/sliced out chunks
  • Ovals
  • Semicircles
  • Adding curves into shapes

Many people want these really badly, but since this only supports perfect circles, would it be possible for you to support non-perfect curves aswell?

Funky 🙂
I'd really like a capsule shape, since it's quite useful and has relatively inexpensive collision detection.
I've done work on this in the past, though it's all code rotted now. I can tell you it is not easy to add more shapes to Box2D. Any all of the things described can easily be approximated by polygons.
BorisTheBrave wrote:
I've done work on this in the past, though it's all code rotted now. I can tell you it is not easy to add more shapes to Box2D. Any all of the things described can easily be approximated by polygons.


I'd probably take out the circle shape too actually. Don't you have to do shape1 vs shape2, shape1 vs shape1 and shape2 vs shape2, just for 2 shapes? So 2^(number of shapes) tests? Or something like that.
(shapes)^2/2, yes. In practise it is not that bad, as e.g. a true generalized capsule-capsule test (as more professional engines have), cover circles and polygons as a subset, just less efficiently.

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