
Game Physics Cookbook
By :

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.
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.
Follow these steps to replace the Euler Integration of the Particle
class with Verlet Integration:
velocity
variable from the definition of the Particle
class in Particle.h
.Update
method of the Particle
class in Particle.cpp
. This new implementation will perform...