
Hi,
If you could help me with this issue it would be great!
I'm switching from Farseer to Box2d.xna because of performance issues. Since this engine is limited to 8 vertexes per polygon, is there a way to section the vertexes of a complex polygon into several 8vertex polygons? I'm trying to read the polygon definition
from a file where I wrote the vertexes, but I keep getting a warning of a negative area at PolygonShape.cs, line 155.
Thanks in advance.


Coordinator
Mar 9, 2010 at 3:15 PM

You are correct that box2d only supports 8 vertices per polygon. The way you represent higher vertex polygons is by using multiple shapes. To turn an arbitrary polygon into a simpler polygon you'll need to implement some form of tesselation.
Ear clipping is a relatively straitforward way to do this. It will give you triangles, which you can then attempt to combine into sets of shapes with <= 8 vertices.
Brandon



Ok, thanks!



I wrote a helper class to load a triangle list from a complex polygon using the algorithm you mentioned. If someone is interested in using it go
here.



The latest release of Farseer physics has 2 polygon decomposition algorithms that can easily be ported over to Box2d.XNA.

