initialize method

void initialize(
  1. A body1,
  2. B body2,
  3. Vector2 anchor1,
  4. Vector2 anchor2,
)

Initialize the bodies, anchors, and length using the world anchors.

Implementation

void initialize(A body1, B body2, Vector2 anchor1, Vector2 anchor2) {
  bodyA = body1;
  bodyB = body2;
  localAnchorA.setFrom(bodyA.localPoint(anchor1));
  localAnchorB.setFrom(bodyB.localPoint(anchor2));
  final d = anchor2 - anchor1;
  length = d.length;
}