Package jsim.solver

Class ImpulseSolver

java.lang.Object
jsim.solver.ImpulseSolver

public final class ImpulseSolver extends Object
Sequential impulse (Projected Gauss-Seidel) constraint solver.

For each contact the solver iterates:

  1. Compute relative velocity at the contact point.
  2. Project a normal impulse j_n ≥ 0 that opposes penetration (with restitution).
  3. Project a tangential impulse j_t clamped by Coulomb: |j_t| ≤ μ · j_n.
  4. Apply accumulated impulses directly to each body's velocity state.

Both linear and angular response are included: the angular term uses the pre-computed world-frame inverse inertia tensor RigidBody.invIWorld.

  • Constructor Details

    • ImpulseSolver

      public ImpulseSolver()
      Create a solver with the default iteration count.
    • ImpulseSolver

      public ImpulseSolver(int iterations)
      Create a solver with a custom iteration count.
      Parameters:
      iterations - number of PGS passes per tick (higher = more accurate, slower)
  • Method Details

    • solve

      public void solve(List<ContactPoint> contacts, double dt)
      Build constraint data from contacts, then run iterations solve passes.
      Parameters:
      contacts - the contact points to resolve
      dt - simulation timestep (seconds)