solveSolid method

void solveSolid(
  1. TimeStep step
)

Implementation

void solveSolid(TimeStep step) {
  // applies extra repulsive force from solid particle groups
  // TODO(spydon): Why was this separate depth buffer used?
  //final depthBuffer = Float64List(_particleCount);
  final ejectionStrength = step.invDt * this.ejectionStrength;
  for (final contact in contactBuffer) {
    final particleA = contact.particleA;
    final particleB = contact.particleB;
    if (particleA.group != particleB.group) {
      final w = contact.weight;
      final n = contact.normal;
      final h = particleA.depth + particleB.depth;
      final va = particleA.velocity;
      final vb = particleA.velocity;
      final inter = ejectionStrength * h * w;
      final fx = inter * n.x;
      final fy = inter * n.y;
      va.x -= fx;
      va.y -= fy;
      vb.x += fx;
      vb.y += fy;
    }
  }
}