Particle Simulation

9.Particles & Euler Integration

Simulate a single particle from a force, using Euler integration.

§RRead

Position changes with velocity; velocity changes with force.

This is the entire physics engine in two lines: vel += (force / mass) * dt then pos += vel * dt. Each frame, we nudge velocity by the acceleration (force divided by mass), then nudge position by the new velocity. This is Euler integration — the simplest possible numerical method.

It is not perfectly accurate. With large dt, the trajectory drifts from the true answer. But for games and interactive simulations, it works beautifully when dt is small (60 fps or better).

§TTry

Launch a projectile.

Below: force = (0, -9.8) — gravity. Initial velocity = (3, 5). Press Play and watch the parabolic arc. This is the same math a cannon uses.

fig. 9-1
dt:0.016
pos:
vel:
change values, then Reset
fig. 9-1 — euler-integrator — projectile under gravity, dt = 0.016s
§PPredict

What's the trajectory shape?

A constant downward force plus an initial velocity at an angle produces what curve?

Reveal

A parabola. This is projectile motion — the same shape whether it is a cannon ball, a basketball, or a water fountain. x grows linearly with time, y follows a quadratic.

§VVerify

Watch Euler error grow with large dt.

Increase dt from 0.016 to 0.1 or 0.2 using the slider. The trail becomes jagged and the particle overshoots the true parabola. Reduce dt to see it converge back. This is why physics engines run at high tick rates.

fig. 9-2
dt:0.050
pos:
vel:
change values, then Reset
fig. 9-2 — euler-integrator — increase dt to see integration error
§MModify

Hit the ring.

Challenge: The gold ring below is at the apex of a parabolic arc. Adjust the playground (reset and re-play with different mental models of the initial conditions) until the particle passes through the ring.

fig. 9-3
pos:
vel:
change values, then Reset
fig. 9-3 — euler-integrator — pass through the target ring
Checkpoint

You understand Euler integration — the computational heart of every physics engine. Position and velocity, nudged forward each frame. Mark complete.