/// <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); }
/// <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(); }