当前位置: 首页>>代码示例>>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;未经允许,请勿转载。