Code Poetry
and Text Adventures

by catid posted (>30 days ago) 12:07pm Mon. Mar 30th 2015 PDT
Dead Reckoning for 0 acceleration:

Integrate between (x, v, a=0) at t = 0, to (x, v, a=0) at t = dt, where acceleration 'a' is zero over the time interval [0, dt].

x += v * dt;

Velocity Verlet for constant acceleration:

Integrate between (x, v, a) at t = 0, to (x, v, a) at t = dt, where acceleration 'a' is constant over the time interval [0, dt].

v0 = v;
v += a * dt;
x += 0.5 * (v0 + v) * dt;

Reference for Velocity Verlet: http://lolengine.net/blog/2011/12/14/understanding-motion-in-games

Newmark (Beta = 1/6, Gamma = 1/2) for linearly interpolated acceleration:

Integrate between (x, v, a0) at t = 0, to (x, v, a1) at t = dt, where acceleration a lerps between a0 and a1 over the time interval [0, dt].

v0 = v;
v += 0.5 * dt * (a0 + a1);
x += dt * (v0 + dt * (2.0 * a0 + a1) / 6.0);

Reference for Newmark Beta: http://mat21.etsii.upm.es/mbs/bookPDFs/Chapter07.pdf


Discussion

These simple integrators are nice and fast and exact.
last edit by catid edited (>30 days ago) 12:10pm Mon. Mar 30th 2015 PDT