finallyofangel wrote:
Thank you for your reply.
I want create specific shapes for collision detection purposes.
I know how to create a special shape with many simpler shapes,but I feel it's too Low efficiency.I not sure that is any other way to draw the specific shapes?
I thought that if we use a simpler shape to reduce a simpler shape,it will be easy to make a special shape.But as I know,Box2d is non of this function.
If we must to create specific shapes for collision detection purposes,how to make it more easy or quick?Is that any way?
Sorry, forgot to subscribe to the thread :)
It sounds like the problem you're facing is basically an issue of what shapes Box2D supports vs. what shapes you'd like it to support.
I think what you have to keep in mind is that even in 2-d there's a more or less arbitrary number of different possible shapes that could potentially be supported: line segments, boxes, circles, capsules, arbitrary convex polygons, 'rounded' boxes, wedges, semicircles, etc.
Generally, for practical reasons a physics engine will only support a subset of the shapes that are possible. There are general algorithms such as GJK that allow for more or less arbitrary convex shapes, but as you might expect, there are tradeoffs with such algorithms.
By 'reduce a simpler shape to make a special shape', I assume you're referring to Boolean subtraction? If so, keep in mind that non-convex shapes are even trickier to handle than arbitrary convex-shapes (of course other Boolean operations can result in non-convex shapes as well).
You can always request features for possible future inclusion in the library of course, but for the time being at least my recommendation would be to try creating the shapes you have in mind using the shapes that Box2D supports; depending on what you have in mind exactly, you might find that the results or more effective and efficient than you expect.