Verlet Integration

Earlier in this chapter, we discussed how and why Euler Integration becomes less stable over time. We provided a better way to integrate position, Velocity Verlet Integration. While better than Euler Integration, the new method provided can become unstable too. In this section, we will discuss in detail implementing a more stable integration method: Verlet Integration.

Getting ready

In order to move particles using Verlet Integration, we need to re-implement both the Update and SolveConstraints methods of the Particle class. We need to re-implement these functions in a way that finds the velocity of a particle using the previous and current positions of the particle.

How to do it…

Follow these steps to replace the Euler Integration ...

Get Game Physics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.