Package jsim.solver
Class ImpulseSolver
java.lang.Object
jsim.solver.ImpulseSolver
Sequential impulse (Projected Gauss-Seidel) constraint solver.
For each contact the solver iterates:
- Compute relative velocity at the contact point.
- Project a normal impulse j_n ≥ 0 that opposes penetration (with restitution).
- Project a tangential impulse j_t clamped by Coulomb: |j_t| ≤ μ · j_n.
- 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 Summary
ConstructorsConstructorDescriptionCreate a solver with the default iteration count.ImpulseSolver(int iterations) Create a solver with a custom iteration count. -
Method Summary
Modifier and TypeMethodDescriptionvoidsolve(List<ContactPoint> contacts, double dt) Build constraint data from contacts, then runiterationssolve passes.
-
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
Build constraint data from contacts, then runiterationssolve passes.- Parameters:
contacts- the contact points to resolvedt- simulation timestep (seconds)
-