本文整理汇总了C#中Body.GetWorldPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Body.GetWorldPosition方法的具体用法?C# Body.GetWorldPosition怎么用?C# Body.GetWorldPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Body
的用法示例。
在下文中一共展示了Body.GetWorldPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FixedLinearSpring
public FixedLinearSpring(Body body, Vector2 bodyAttachPoint, Vector2 worldAttachPoint, float springConstant,
float dampingConstant)
{
_body = body;
_bodyAttachPoint = bodyAttachPoint;
_worldAttachPoint = worldAttachPoint;
SpringConstant = springConstant;
DampingConstant = dampingConstant;
_difference = worldAttachPoint - _body.GetWorldPosition(bodyAttachPoint);
_restLength = _difference.Length();
}
示例2: LinearSpring
public LinearSpring(Body body1, Vector2 attachPoint1, Body body2, Vector2 attachPoint2, float springConstant,
float dampingConstant)
{
_body1 = body1;
_body2 = body2;
_attachPoint1 = attachPoint1;
_attachPoint2 = attachPoint2;
SpringConstant = springConstant;
DampingConstant = dampingConstant;
_difference = body2.GetWorldPosition(attachPoint2) - body1.GetWorldPosition(attachPoint1);
_restLength = _difference.Length();
}
示例3: PinJoint
public PinJoint(Body body1, Vector2 anchor1, Body body2, Vector2 anchor2)
{
_body1 = body1;
_body2 = body2;
//From http://www.codeplex.com/Thread/View.aspx?ProjectName=FarseerPhysics&ThreadId=22839
//Vector2 difference = (body2.position + anchor2) - (body1.position + anchor1);
//_targetDistance = difference.Length(); //by default the target distance is the diff between anchors.
//Also take rotation into account
Vector2 difference = body2.GetWorldPosition(anchor2) - body1.GetWorldPosition(anchor1);
_targetDistance = difference.Length(); //by default the target distance is the diff between anchors.
//initialize the world anchors (only needed to give valid values to the WorldAnchor properties)
Anchor1 = anchor1;
Anchor2 = anchor2;
}