So as the title says, I’m trying to get a position of a Fixture in Farseer Physics. So the first step I took was to see how the DebugView did it.(line 445 in https://github.com/tinco/Farseer-Physics/blob/master/DebugViews/DebugView%20XNA/DebugViewXNA.cs, draws all of the shape types).
Here we can see, all we gotta do is cast the fixtures shape into its actual shape type, such as Circle then use CircleShape.Position. AWESOME! But what about rectangles and Polygons and other shapes? Well the shape type of Rectangle Fixture, is a Polygon, so really we need to just figure it out for the polygon now(it doesn’t have Position property ). Here is the code for the Polygon vs the Circle
case ShapeType.Circle:
{
CircleShape circle = (CircleShape)fixture.Shape;
Vector2 center = MathUtils.Mul(ref xf, circle.Position);
float radius = circle.Radius;
Vector2 axis = MathUtils.Mul(xf.q, new Vector2(1.0f, 0.0f));
DrawSolidCircle(center, radius, axis, color);
}
break;
case ShapeType.Polygon:
{
PolygonShape poly = (PolygonShape)fixture.Shape;
int vertexCount = poly.Vertices.Count;
Debug.Assert(vertexCount <= Settings.MaxPolygonVertices);
for (int i = 0; i < vertexCount; ++i)
{
_tempVertices[i] = MathUtils.Mul(ref xf, poly.Vertices[i]);
}
DrawSolidPolygon(_tempVertices, vertexCount, color);
}
break;`
so I’m really lost at this point. Could anyone help me on this please?