Polygon shapes



Choosing the polygon shape type for a fixture will make a solid polygon from the vertices.

Setting a non-zero radius for the shape will make a 'fat' polygon, with extra circles and polygons added along the edges.

Under the Display tab of the Options dialog, you can alter the opacity of the internal lines to make them either more or less prominent - an opacity of zero makes the internal lines fade out completely:

Polygon shapes cannot be constructed correctly if they have self-intersecting segments. Self-intersecting segments will be shown in red if they exist, and you will see messages like this in the message log


Polygon generation
Box2D polygons should be convex with a maximum of 8 vertices and 'wound' in a counter-clockwise order, but R.U.B.E will take care of all that for you. There are a few points to note though, which can help to get the best arrangement of polygons.

When polygons are concave or have more than 8 vertices, R.U.B.E uses one of two available methods to generate the final polygons to give to Box2D. The default 'Bayazit' algorithm (http://mnbayazit.com/406/bayazit) which usually creates more desirable shapes for use in Box2D worlds (less long thin shapes, and fewer polygons overall), and the 'poly2tri' algorithm (http://code.google.com/p/poly2tri/) which decomposes polygons into triangles and is used as a fallback for cases that the Bayazit algorithm does not handle well.

The implementation of the Bayazit algorithm in R.U.B.E requires that the input polygon vertices be in a counter-clockwise order. If they are not, the poly2tri algorithm is used and you may see messages like this in the message log.

You can reverse the vertex winding of selected fixtures by choosing 'Fixture'->'Reverse vertex winding' from the action menu.

Another case where the poly2tri method will be used as a fallback is when the vertices of the input polygon are colinear:

You can select which algorithm should be used by default under the Geometry tab of the Options dialog.