本文整理匯總了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;
}