Advice questions to Erin on Concave Shape Dynamics.

General Box2D issues or C++ specific issues
mcourteaux
Posts: 22
Joined: Fri Jun 25, 2010 4:42 am

Advice questions to Erin on Concave Shape Dynamics.

Postby mcourteaux » Thu Aug 27, 2015 4:10 am

This is a question to Erin.

I'm trying to modify Box2D so that it supports concave dynamic shapes. However, before putting in this effort, I would like to hear from you some best practices and if it is even possible.
  • I would like to support concave dynamic bodies with over 100+ vertices.
  • Should I achieve this by modifying Polygons or looped ChainShapes?
  • If I modify Polygons, should I modify collision detection?
  • If I modify Polygons, I already know that I should modify the MassData calculations to support concave shapes using triangulation.
  • If I modify ChainShapes, any tips?
  • I know that there is working Polygon-Polygon collision detection and evaluation.
  • There is no Edge-Edge collision detection and evaluation yet.
  • Will using ChainShapes screw performance and the internally used search tree?
  • Or should I create a new Shape type like b2ComplexConcavePolygonShape? I'm thinking about this in order to not kill performance of b2PolygonShape code and b2ChainShape code.

Any advice on what decisions to make, keeping performance in mind.

Where would you start? If you like I can fork the GitHub project to make these changes and contribute to the project.
I would love it if it would be finally possible.

Greetings,
Martijn

Louis Langholtz
Posts: 21
Joined: Tue Dec 20, 2016 10:53 am

Re: Advice questions to Erin on Concave Shape Dynamics.

Postby Louis Langholtz » Fri May 05, 2017 7:43 am

Hi mcourteaux,

Great questions! I have been wondering about concave dynamics too.

In a sense, Box2D already supports concave dynamic shapes. Just not as a subclass of b2Shape. But as multiple convex fixtures on a single body they are. If we accept then that concave dynamics are already supported via composition, what benefits are there to supporting it via inheritance?

That's the "million dollar question" I've gotten to in regards to this.

There is an older and more general debate that seems related to this with many suggesting in principal, that composition should be favored over inheritance. While I agree with this position in theory, I've been questioning how much redesign adhering to that principal would entail vs. essentially just subclassing b2Shape and using the child indexing.

As for edge-edge collision detection, I've added those in my own fork of the library. Conceptually for me, these were the same as doing polygon-polygon collisions after I generalized that calculation to all N-gons with 1 or more vertices.

Have you made any progress on this since your original post or had any more thoughts on this since then?


Return to “Bugs, Requests, and Feedback”



Who is online

Users browsing this forum: No registered users and 2 guests