initialize method

void initialize(
  1. Body b1,
  2. Body b2,
  3. Vector2 anchor1,
  4. Vector2 anchor2
)

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

@param b1 First body @param b2 Second body @param anchor1 World anchor on first body @param anchor2 World anchor on second body

Implementation

void initialize(final Body b1, final Body b2, final Vector2 anchor1,
    final Vector2 anchor2) {
  bodyA = b1;
  bodyB = b2;
  localAnchorA.setFrom(bodyA.getLocalPoint(anchor1));
  localAnchorB.setFrom(bodyB.getLocalPoint(anchor2));
  Vector2 d = anchor2 - anchor1;
  length = d.length;
}