What changed in polygon placement?

Coordinator
Jul 19, 2008 at 7:19 AM
Edited Jul 19, 2008 at 8:33 AM
It's been a while creating games with farseer. I took all my old projects and updated them to Farseer 1.0.0.5.
It works fine.... except objects created from polygons.

If I create a circle it works fine, but if I create a polygon body, there seems to be an offset in the polygons.
What is changed between 1.0.0.3 that I used before and 1.0.0.5 that could cause this?

Edit: Seems to be in 1.0.0.4 too

Edit2: Seems to be caused by CreatePolygonGeom() and GetMomentOfInertia() trying to center the vertices on the centroid. Commenting out this fixes my problem.

Would like to hear if others have the same problem or I'm just adding the wrong points (for the polygons) to the engine.
Jul 25, 2008 at 8:51 PM
I'm actually seeing the same problem.  I've created a polygon static object and updated it's position but all of the vertices seem to be about negative 80-100 units on the X-axis.  I am drawing the polys on screen and everything lines up except for the collisions which think the objects are farther to the left than they really are......
Jul 25, 2008 at 9:04 PM
Actually, I found my problem.

I was creating the polygon body and then doing a myBody.Position = new Vector2(0,0);

After that I would then set the body position to be where I expected the top-left corner to start on the game field.  What I didn't realize is that the polygon body position is at the centroid of the poly, not the upper-left corner.  This was causing my poly to appear "to the left" in collision but not visible as my visible vertices were put down prior to the centroid calculation (based on the verts passed to the polygon create command.)  Anyway, now that I know the body position is at the centroid I just adjust the body position in relative terms and it works out fine.