Sep 20, 2009 at 11:53 AM
Edited Sep 20, 2009 at 11:55 AM
I am also modifying polygons in my editor. I am doing it the way LittleBigPlanet does it, using shapes like a cookie-cutter or paintbrush.
I am using the GPC Polygon Clipping Library for the clipping though, as the Farseer union/subtract functions sometimes gave me bad results on complicated polygons, like those with holes. The
GPC library also does really good triangulation, which I use a lot.
When I last used the Farseer functions I don't think that using Union/Subtract actually centered the vertices, that you had to do it yourself. This was the first 2.1 release, so it might have changed. If it was added later you can probably go into the Vertices
class and take that out.
After that you just get the centroid of the new new shape, and then offset the new Body's position by that. (like what Cowdozer said)
I tried to find my old code for you, but I think it's lost. Sorry! :(
I hope I helped a bit anyway.