Efficiently querying chain shapes (broadphase)

Chainshapes are collections of edgeshapes for which it is assumed that the edge shapes' shadow vertices are to be set to the appropriate adjacent vertices in the chain. This allows for chains (when allocated) to consume half the memory space as edge shapes, which is good.

It looks like the chainshape upon creation will insert all its child-edges into the broadphase when it is set but the ReportFixtures signature in b2WorldQueryWrapper does not give any info other than the fixture.

I modified the ReportFixture to provide an integer also (the child edge index). I simply pass in
Code:
proxy->childIndex
to ReportFixture.

This requires changing like two lines of code in box2d and also about two lines in the testbed. Not bad at all.

It may also be a good idea to have a custom routine for testing raycasts and distances against a chainshape, perhaps a chain shape would have its own specialized subdivision tree for its edges. Because testing against edges is pretty neat, you can use their vertex positions as AABB limits.

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