Centering Polygon Problem

Topics: User Forum
Apr 6, 2010 at 6:05 PM

I'm using the flatredball polygon editor to make the geometry for my levels.  When I bring it in to farseer, it moves the center of the Polygon to 0, 0.  Is there a way to find out how much this polygon was offset by so I can put it back where it belongs?

Apr 6, 2010 at 8:29 PM

Yes you should use verts.GetCentroid() when you use the CreatePolygon function and then translate your object accordingly.

Apr 6, 2010 at 8:46 PM

Translate as in set the body's position?  Because that's not working for me...

Apr 6, 2010 at 9:57 PM

Nevermind, FlatRedBall polygon objects have an X and Y associated with them.  If I add the polygons x and y to the position of the body after it and the geom are created then It ends up where I need it to be.