update method

  1. @override
void update()
override

Update all the equations with data.

Implementation

@override
void update() {
  final bodyA = this.bodyA;
  final bodyB = this.bodyB;
  final eq = distanceEquation;
  final halfDist = _restLength * 0.5;
  final normal = eq.ni;

  bodyB.position.sub2(bodyA.position, normal);
  normal.normalize();
  normal.scale2(halfDist, eq.ri);
  normal.scale2(-halfDist, eq.rj);
}