Here’s a code snippet for adding automatic orientation into Farseer Physics.

This is what I edited in Geometry.cs: [csharp] protected void SetVertices(Vertices vertices) { if (!VerticesCCW(vertices)) { vertices.Reverse(); } _localVertices = new Vertices(vertices); _worldVertices = new Vertices(vertices); _aabb.Update(_localVertices); }

///

/// Determine if the passed in

/// list of vertices is oriented /// CCW. ///

/// /// true if oriented counter-clockwise protected bool VerticesCCW(Vertices vertices) { float sum = 0; Vector2[] verts = vertices.ToArray(); // the sign of the ‘area’ of the polygon is all // we are interested in. for (int i = 0; i < verts.Length; i++) { int nextIndex = i + 1; if (i == verts.Length - 1) { nextIndex = 0; } sum += (verts[i].X * verts[nextIndex].Y - verts[nextIndex].X * verts[i].Y); } return (sum <= 0); } [/csharp]