Physics engines

Level UniversityDifficulty ★★★★★Application⌖ Open in the map

What is it?

Software that advances a world of bodies in small time steps: accumulate forces, integrate velocities and positions (semi-implicit Euler or Verlet), detect collisions, resolve contacts. A numerical ODE solver tuned for speed and stability rather than accuracy.

Why does it exist?

Games and films need plausible motion in real time for thousands of objects. Exact solutions do not exist, and accuracy matters less than never exploding: a ragdoll that jitters is a bug, one that is 1% off is not.

Formulas

vn+1=vn+h Fnm,xn+1=xn+h vn+1v_{n+1} = v_n + h\,\frac{F_n}{m}, \qquad x_{n+1} = x_n + h\,v_{n+1}
semi-implicit (symplectic) Euler
xn+1=2xn−xn−1+h2 Fnmx_{n+1} = 2x_n - x_{n-1} + h^2\,\frac{F_n}{m}
Verlet integration (second order, symplectic)

How is it computed?

every frame (h = 1/60 s, often split into substeps):
    for each body: F = gravity + springs + user forces
    for each body: v += h · F/m ;  x += h · v        # semi-implicit Euler
    detect collisions;  apply impulses to fix contacts

Why does it matter?

Unity, Unreal, Godot, robotics simulators (MuJoCo, Isaac) and VFX tools all have one at their core; differentiable versions let robots learn by gradient descent through physics.

The mathematics behind it

  • Vectors★★★★★fundamental

    Positions, velocities and forces are 3D vectors updated every frame.

  • Derivative★★★★★fundamental

    Engines store positions and their derivatives (velocities) and advance them frame by frame.

  • Numerical stability★★★★★fundamental

    Explicit integrators with too large a time step blow up; engines pick stable schemes and sub-step.

  • Ordinary differential equations★★★★★fundamental

    A physics engine integrates x˙=v\dot x = v, v˙=F/m\dot v = F/m for every body, every frame.

  • Euler's method★★★★★fundamental

    Semi-implicit Euler is the default integrator of Box2D, Bullet and most game engines.

  • Definite integral★★★★★frequent

    Positions are integrals of velocities, velocities integrals of accelerations.

  • Fundamental theorem of calculus★★★★★fundamental

    Integrating velocity gives position: every simulation step is a tiny application of the FTC.

  • Taylor polynomial★★★★★frequent

    Integrators (Euler, Verlet) are truncated Taylor expansions of the motion in the time step.

  • Springs and dampers drive cloth, ragdolls, camera smoothing and vehicle suspensions.

  • Stiffness and implicit methods★★★★★frequent

    Cloth and soft bodies use implicit integration (Baraff–Witkin) so stiff springs do not explode.

  • Continuity★★★★★frequent

    Simulation assumes motion is continuous between frames; collisions break that and are handled separately.

  • Newton's method★★★★★advanced

    Implicit integrators for stiff systems (cloth, soft bodies) solve a nonlinear system with Newton each step.

  • Vector fields★★★★★frequent

    Wind, gravity wells and particle effects are applied as force fields.

  • Non-Lipschitz forces (contacts, friction switches) break uniqueness, which is why engines treat them specially.

Where is it used?

Computing topics reachable from here, through the chain of ideas that leads to them:

What depends on it

↑ ↓ to navigate · ↵ · Esc