update method

  1. @override
void update()
override

update

Implementation

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

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