當前位置: 首頁>>代碼示例>>C#>>正文


C# Body.GetWorldPosition方法代碼示例

本文整理匯總了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();
 }
開發者ID:ninetailsdev,項目名稱:Quark,代碼行數:11,代碼來源:FixedLinearSpring.cs

示例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();
 }
開發者ID:amwaterston,項目名稱:paradux,代碼行數:12,代碼來源:LinearSpring.cs

示例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;
        }
開發者ID:amwaterston,項目名稱:paradux,代碼行數:17,代碼來源:PinJoint.cs


注:本文中的Body.GetWorldPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。