getImpactVelocityAlongNormal method

double getImpactVelocityAlongNormal()

Get the current relative velocity in the contact point.

Implementation

double getImpactVelocityAlongNormal(){
  final vi = _contactEquationGetImpactVelocityAlongNormalVi;
  final vj = _contactEquationGetImpactVelocityAlongNormalVj;
  final xi = _contactEquationGetImpactVelocityAlongNormalXi;
  final xj = _contactEquationGetImpactVelocityAlongNormalXj;
  final relVel = _contactEquationGetImpactVelocityAlongNormalRelVel;

  bi.position.vadd(ri, xi);
  bj.position.vadd(rj, xj);

  bi.getVelocityAtWorldPoint(xi, vi);
  bj.getVelocityAtWorldPoint(xj, vj);

  vi.vsub(vj, relVel);

  return ni.dot(relVel);
}