本文整理汇总了C#中Box2D.Common.Vec2.sub方法的典型用法代码示例。如果您正苦于以下问题:C# Vec2.sub方法的具体用法?C# Vec2.sub怎么用?C# Vec2.sub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box2D.Common.Vec2
的用法示例。
在下文中一共展示了Vec2.sub方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initialize
/// <summary>
/// Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
/// </summary>
public virtual void initialize(Body b1, Body b2, Vec2 ga1, Vec2 ga2, Vec2 anchor1, Vec2 anchor2, float r)
{
bodyA = b1;
bodyB = b2;
groundAnchorA = ga1;
groundAnchorB = ga2;
localAnchorA = bodyA.getLocalPoint(anchor1);
localAnchorB = bodyB.getLocalPoint(anchor2);
Vec2 d1 = anchor1.sub(ga1);
lengthA = d1.length();
Vec2 d2 = anchor2.sub(ga2);
lengthB = d2.length();
ratio = r;
Debug.Assert(ratio > Settings.EPSILON);
}
示例2: initialize
/// <summary>
/// Initialize the bodies, anchors, and length using the world anchors.
/// </summary>
/// <param name="b1">First body</param>
/// <param name="b2">Second body</param>
/// <param name="anchor1">World anchor on first body</param>
/// <param name="anchor2">World anchor on second body</param>
public virtual void initialize(Body b1, Body b2, Vec2 anchor1, Vec2 anchor2)
{
bodyA = b1;
bodyB = b2;
localAnchorA.set_Renamed(bodyA.getLocalPoint(anchor1));
localAnchorB.set_Renamed(bodyB.getLocalPoint(anchor2));
Vec2 d = anchor2.sub(anchor1);
length = d.length();
}