Simulated Animation Effects Week#8

Started adding support for complex shapes, so that they are now simulated by their shape instead of their bounding box.

  • Added support for PolyPolygonShape and ClosedBezierShape so far.

Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.

short demonstration video showing complex shapes in action

Up till this point, all shapes in the slideshows were approximated by their bounding box in the simulations.

Since it is not really pleasant to have everything simulated as boxes, last week I’ve started to add support for complex shapes that are represented by their polygon/curve shapes.

I’ve got the geometry information directly from XShapes.
There was a problem since Box2D only accepted convex polygons as shapes. So as a generalized solution I’ve triangulated shapes using basegfx::triangulator::triangulate() and added the resulting vector of triangles to a box2d body using individual fixtures for the triangles.

My main approach for creating complex shapes right now is converting the shape to a B2DPolyPolygon then triangulating it and adding the triangle pieces to a box2d body.
This approach worked OK for PolyPolygonShapes and ClosedBezierShapes. I will start this week by adding support for CustomShapes, hopefully it will be possible to convert them into B2DPolyPolygons and use a similar approach for them too.

Check out the whole implementation on gsoc-box2d-experimental branch