//Contributed by Matthew Bettcher
/// <summary>
/// Convert a path into a set of edges and attaches them to the specified body.
/// Note: use only for static edges.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="body">The body.</param>
/// <param name="subdivisions">The subdivisions.</param>
public static void convertPathToEdges( Path path, Body body, int subdivisions )
{
var verts = path.getVertices( subdivisions );
if( path.isClosed )
{
var chain = new ChainShape( verts, true );
body.createFixture( chain );
}
else
{
for( int i = 1; i < verts.Count; i++ )
{
body.createFixture( new EdgeShape( verts[i], verts[i - 1] ) );
}
}
}