Help me put static complex shapes in box2d

Hello everyone, help me please…
I think everyone knows box2d library written by Shiffman.
In his examples he adds boundaries only rectangle shape.I want to add a half circle to the edges of that rectangle. (From left and right). And I want to rotate them 45 degrees…Please help me doing this.

1 Like

It sounds like you want to create a D-shaped boundary, is that right?

You can make a curve out of many small edges, for example using chain shapes:

So, complex shapes that are curves are actually polygons with many, many small sides. All the normal rules of complex polygons apply.

Keep in mind that you can draw something different from what Box2D is modeling. So if you want to model the shape and track its location physics with box2D, but draw it using a curve or a bezier curve, you can – you can draw on top of it, or draw to a separate canvas, etc.