本文整理汇总了C#中FarseerPhysics.Dynamics.Body.GetWorldPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Body.GetWorldPoint方法的具体用法?C# Body.GetWorldPoint怎么用?C# Body.GetWorldPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FarseerPhysics.Dynamics.Body
的用法示例。
在下文中一共展示了Body.GetWorldPoint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRevoluteJoint
/// <summary>
/// Creates a revolute joint and adds it to the world
/// </summary>
/// <param name="world"></param>
/// <param name="bodyA"></param>
/// <param name="bodyB"></param>
/// <param name="anchorB"></param>
/// <returns></returns>
public static RevoluteJoint CreateRevoluteJoint(World world, Body bodyA, Body bodyB, Vector2 anchorB)
{
Vector2 localanchorA = bodyA.GetLocalPoint(bodyB.GetWorldPoint(anchorB));
RevoluteJoint joint = new RevoluteJoint(bodyA, bodyB, localanchorA, anchorB);
world.AddJoint(joint);
return joint;
}
示例2: DrawFixture
private void DrawFixture(Graphic g, Body body, Fixture fixture, Color color)
{
switch (fixture.Shape.ShapeType)
{
case ShapeType.Circle:
{
var circle = (CircleShape)fixture.Shape;
Vector2 center = body.GetWorldPoint(circle.Position);
if (DrawSolidShape)
{
g.DrawSolidCircle(center, circle.Radius, color);
}
else
{
g.DrawCircle(center, circle.Radius, color);
}
break;
}
case ShapeType.Polygon:
{
TempVertices.Clear();
var poly = fixture.Shape as PolygonShape;
int vertexCount = poly.Vertices.Count;
for (int i = 0; i < vertexCount; ++i)
{
var p = body.GetWorldPoint(poly.Vertices[i]);
TempVertices.Add(p);
}
if (DrawSolidShape)
{
g.DrawSolidPolygon(TempVertices.ToArray(), color);
}
else
{
g.DrawPolygon(TempVertices.ToArray(), color);
}
break;
}
}
}
示例3: CreateRevoluteJoint
/// <summary>
/// Creates a revolute joint.
/// </summary>
/// <param name="bodyA"></param>
/// <param name="bodyB"></param>
/// <param name="localAnchorB">The anchor of bodyB in local coordinates</param>
/// <returns></returns>
public static RevoluteJoint CreateRevoluteJoint(Body bodyA, Body bodyB, Vector2 localAnchorB)
{
Vector2 localanchorA = bodyA.GetLocalPoint(bodyB.GetWorldPoint(localAnchorB));
RevoluteJoint joint = new RevoluteJoint(bodyA, bodyB, localanchorA, localAnchorB);
return joint;
}
示例4: CreatePrismaticJoint
/// <summary>
/// Creates a prsimatic joint
/// </summary>
/// <param name="bodyA"></param>
/// <param name="bodyB"></param>
/// <param name="localanchorB"></param>
/// <param name="axis"></param>
/// <returns></returns>
public static PrismaticJoint CreatePrismaticJoint(Body bodyA, Body bodyB, Vector2 localanchorB, Vector2 axis)
{
Vector2 localanchorA = bodyA.GetLocalPoint(bodyB.GetWorldPoint(localanchorB));
PrismaticJoint joint = new PrismaticJoint(bodyA, bodyB, localanchorA, localanchorB, axis);
return joint;
}
示例5: CreateWeldJoint
/// <summary>
/// Creates a weld joint
/// </summary>
/// <param name="world"></param>
/// <param name="bodyA"></param>
/// <param name="bodyB"></param>
/// <param name="localanchorB"></param>
/// <returns></returns>
public static WeldJoint CreateWeldJoint(Body bodyA, Body bodyB, Vector2 localanchorB)
{
Vector2 localanchorA = bodyA.GetLocalPoint(bodyB.GetWorldPoint(localanchorB));
WeldJoint joint = new WeldJoint(bodyA, bodyB, localanchorA, localanchorB);
return joint;
}