本文整理汇总了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, 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 void Initialize(Body b1, Body b2, Vec2 anchor1, Vec2 anchor2)
{
BodyA = b1;
BodyB = b2;
LocalAnchorA.Set(BodyA.GetLocalPoint(anchor1));
LocalAnchorB.Set(BodyB.GetLocalPoint(anchor2));
Vec2 d = anchor2.Sub(anchor1);
Length = d.Length();
}
示例2: Initialize
/// <summary>
/// Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
/// </summary>
public 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);
}