本文整理汇总了C#中Fixture.GetBody方法的典型用法代码示例。如果您正苦于以下问题:C# Fixture.GetBody方法的具体用法?C# Fixture.GetBody怎么用?C# Fixture.GetBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fixture
的用法示例。
在下文中一共展示了Fixture.GetBody方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawFixture
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;
}
}