Polygon vertices in world coordinates

Topics: User Forum
Aug 1, 2012 at 1:08 AM

Hey I'm currently writing a DebugDraw class which draws primitives for body's and I can't seem to find the vertices in world coordinates, only in local. Just wondering if there is a quick way to do this without rotating them myself. here's what I've got:

 

        public static void DrawBody(Body B, float pixelsPerMeter, Vector2 scrollOffset)
        {
            foreach (Fixture F in B.FixtureList)
            {
                if (F.ShapeType == FarseerPhysics.Collision.Shapes.ShapeType.Polygon)
                {
                    PolygonShape P = (PolygonShape)F.Shape;
                    for (int i = 0; i < P.Vertices.Count; i++)
                    {
                        DrawLine(P.Vertices[i] + B.Position - scrollOffset, P.Vertices[(i + 1) % P.Vertices.Count] + B.Position - scrollOffset, pixelsPerMeter);
                    }

                }
            }
        }

Coordinator
Aug 7, 2012 at 2:09 AM

Take a look at the DebugViewXNA project that is included in the project. It does exactly the same thing as what you are trying to do.