Example #1
0
        void DrawFixture(Fixture fixture)
	    {
		    Color color = new Color(0.95f, 0.95f, 0.6f);
		    Transform xf;
            fixture.GetBody().GetTransform(out xf);

		    switch (fixture.ShapeType)
		    {
		    case ShapeType.Circle:
			    {
				    CircleShape circle = (CircleShape)fixture.GetShape();

				    Vector2 center = MathUtils.Multiply(ref xf, circle._p);
				    float radius = circle._radius;

				    _debugDraw.DrawCircle(center, radius, color);
			    }
			    break;

		    case ShapeType.Polygon:
			    {
				    PolygonShape poly = (PolygonShape)fixture.GetShape();
				    int vertexCount = poly._vertexCount;
				    Debug.Assert(vertexCount <= Settings.b2_maxPolygonVertices);
                    FixedArray8<Vector2> vertices = new FixedArray8<Vector2>();

				    for (int i = 0; i < vertexCount; ++i)
				    {
					    vertices[i] = MathUtils.Multiply(ref xf, poly._vertices[i]);
				    }

				    _debugDraw.DrawPolygon(ref vertices, vertexCount, color);
			    }
			    break;
		    }
	    }