Hacker News new | ask | show | jobs
by teamonkey 4926 days ago
> This is still Euler integration

Actually it's a form of Verlet integration, which performs much better than Euler's method while being much cheaper than RK4.

Euler's method does not perform well with any form of acceleration and should not be used when acceleration is present. The equations here will remain accurate under constant gravity.

1 comments

actually this is the 'midpoint' method. verlet is different in that it negates needing the first order term altogether, which is instead gotten at any instant from the previous and current position (zeroth order term).

but yes, verlet is much more powerful for game physics, especially when coupled with constraints since it allows all kinds of non-trivial behaviour (angular momentum) to fall out.

IIRC

  Midpoint
  v(n+1) = v(n) + a(n)*dt
  x(n+1) = x + v(n)*dt + 0.5*a(n)*dt^2

  Velocity Verlet
  v(n+1) = v(n) + 0.5*[a(n)+a(n+1)]*dt
  x(n+1) = x + v(n)*dt + 0.25*[a(n)+a(n+1)]*dt^2
With fixed acceleration a(n)=a(n+1) so the two methods are equivalent.