skip to content

When a rigid-body simulation misbehaves, how do you choose between more velocity iterations, more position iterations, substeps or a shorter fixed step?

level: seniorimportance: should knowfreq 40%

answer

  1. rule out scale and mass ratio
  2. velocity passes: bounce, friction, joints
  3. position passes: overlap and drift
  4. substeps: stiffness and ratios
  5. shorter step reruns collision too

basics

~20 s

Rule out units and mass ratios, then match knob to symptom: velocity iterations for sliding stacks and soft joints, position iterations for lingering overlap and separating joints, substeps for stiffness, and a shorter step when collision detection itself is too coarse.

solid answer

~40 s

First rule out causes no iteration count fixes: wrong unit scale, a 200:1 mass ratio, mis-set slop, a variable step fed to the middleware. Then read the symptom. **Velocity iterations** are passes over contact, friction and joint constraints at the velocity level; too few and stacks slide or wobble, friction is weak and joint chains feel springy under load. **Position iterations**, where the middleware separates them, remove leftover overlap and joint drift; too few and bodies stay sunk and jointed links visibly separate. **Substeps** split the step into smaller ones and help most with stiff joint chains, fast spin and heavy-on-light contacts. A **shorter fixed step** improves everything, collision detection included, but costs the whole pipeline. Raise counts per body or island where the middleware allows, and measure solver time for each change.

go deeper

for a junior

Recall that the solver makes several passes per step and that more passes cost more CPU.

for a middle

Explain the difference between velocity passes, position passes, substeps and a shorter step, and what each one multiplies.

for a senior

Rule out unit scale and mass ratio first, then map each symptom to the knob that fixes it and measure solver time per change.

for a principal

Budget physics time per platform and decide which bodies earn higher counts or substeps instead of raising them for the whole world.

## Four knobs that look alike and are not Physics middleware typically exposes several ways to spend more CPU on accuracy. They are not interchangeable, and raising the wrong one burns time without fixing the bug. - **Velocity iterations**: how many passes an iterative solver makes over all velocity constraints (contact non-penetration, friction, joints, restitution) in one step. More passes bring the solution closer to the exact one; an iterative solver passes corrections along a chain one constraint per pass, which is why long chains and stacks need more of them. - **Position iterations**: in solvers that correct positions in a separate pass, the passes that remove remaining overlap and joint drift without adding velocity. Not every middleware has them; some fold correction into the velocity pass as a bias, others use soft constraints with relaxation passes. - **Substeps**: the middleware splits one step into several smaller ones, integrating and solving each. Designs differ in whether collision detection reruns per substep or contacts found at the start are reused. - **Fixed step length**: the length of one whole physics step, for example 1/60 s against 1/120 s. Halving it roughly doubles the per-second cost of everything, broad and narrow phase included. ## Rule out the non-solver causes first Before touching counts, check what no count can fix: 1. **Unit scale**: tolerances tuned for metres in a centimetre world give jitter at any count. 2. **Mass ratio**: a 500 kg wardrobe on a 2 kg crate, a 250:1 ratio, defeats a handful of iterations; lowering the ratio is cheaper than tripling them. 3. **Tolerances**: a slop of zero or a tiny contact distance makes contacts flicker. 4. **Inputs**: a variable step length fed to the middleware, or bodies moved by writing their transform every frame instead of through velocities, break warm starting and stability. ## Matching symptom to knob | Symptom | Likely knob | Why | |---|---|---| | Stack of boxes slides apart or wobbles | velocity iterations | friction and non-penetration have not converged | | Joint chain (a chandelier on links) sags and bounces like rubber | velocity iterations, then substeps | load passes along the chain one link per pass | | Bodies stay sunk after landing | position iterations or correction rate | leftover overlap is not removed | | Jointed links visibly separate at the joints | position iterations | positional drift is not corrected | | Heavy body crushes a light one under it | substeps, after reducing the ratio | each smaller step starts closer to the answer | | Fast spinning bodies wobble or gain energy | substeps or a shorter step | large rotation per step | | Collisions missed or late at speed | shorter step, or continuous collision | detection only runs once per step | ## Cost: what each knob multiplies The solver's cost is roughly proportional to iterations times constraints. Substeps multiply integration and solving, and collision too if it reruns. A shorter step multiplies the whole pipeline. A useful sanity check: 60 Hz with 8 velocity iterations and 120 Hz with 4 make the same number of solver passes per second, 480, but the 120 Hz version also runs collision detection twice as often, and each of its passes starts from a state integrated over a shorter interval, so it often converges better on stiff setups. ## Spend the budget where the symptom is - **Per body or per island overrides**: some middleware let a body request a higher count, and the island it belongs to is solved with the highest count among its members. Give a ragdoll or a vehicle more passes instead of the whole world. - **Measure**: record solver time and the symptom for each step change of a knob. Doubling iterations rarely halves an artefact; one change at a time keeps the cause visible. - **Stop at good enough**: the target is the artefact the player can see, not an exact solution. A sliding stack the camera never shows does not need fixing. ## A worked diagnosis After a brawl, a toppled bookcase lies across two chairs and slowly slides off. The team doubles velocity iterations: the slide slows but does not stop, and solver time doubles. In this scenario, checking the masses shows a 300 kg bookcase on 3 kg chairs, a 100:1 ratio. Raising the chairs to 15 kg (20:1) and restoring the original count stops the slide at the original cost. The knob was never the problem.

  • Why can a shorter fixed step fix a problem that more iterations cannot?
    Iterations refine the solution of one step's constraints, but the contacts and the integration interval are fixed for that step. A shorter step reruns collision detection more often and integrates over a smaller interval, so fast rotation, late contacts and stiff interactions start each solve closer to the truth.
  • When is a per-body iteration override better than a global increase?
    When only a few bodies show the artefact, such as a ragdoll's joint chain or a vehicle's suspension. Raising their island's count pays for passes only where needed, while a global increase multiplies solver cost for every pile of debris in the level.

  • More iterations always fix jitter, whatever its cause
  • Velocity and position iterations are two names for the same passes
  • Substeps cost nothing extra compared with iterations
  • A shorter step only makes the solver more accurate, not collision
  • Raise every count globally rather than measuring which one helps