Game Development Reference
In-Depth Information
hand, we do care about visual quality and stability, and we do care whether our
software runs fast or slow—and semi-implicit methods are usually fast.
The semi-implicit version of Euler integration goes like this:
v ( t t )= v ( t )+ a Δ t,
x ( t t )= x ( t )+ v ( t t t.
By substitution, the second equation is equivalent to x ( t )= x ( t − Δ t )+ v ( t t ,
a fact that together with the above leads us to the Verlet formulation.
11.2.4 Verlet Integration
As mentioned, Verlet integration is an example of a semi-implicit integration
method. The Verlet integration update step is just a reformulation of the expres-
sions given in the previous subsection:
Δ t )+ a ( t )(Δ t ) 2 .
x ( t t )=2 x ( t )
x ( t
Instead of storing the particles' positions x and velocities v as before, it suffices
to store the current position x ( t ) and the previous position x ( t
Δ t ). Velocities
can then be calculated on the fly from x ( t ) and x ( t
Δ t ) (if needed at all):
v ( t t )=( x ( t t )
x ( t )) / Δ t.
This relation means that positions and velocities are always in sync.
Since x ( t )
Δ t ) is just the change in position from the last time frame,
the Verlet formula can be interpreted as follows:
x ( t
1. Add to the current position the distance we just moved in the previous time
2. Adjust the position to account for gravity and other forces.
3. The new velocity is directly proportional to the total step we just moved.
Be aware that because velocity is now given only implicitly by using the previous
positions of the particles, the time step needs to be kept constant between each
call to the numerical integrator. While it is possible to develop formulas that take
changing time steps into account, in my experience, the best way to handle larger
time steps is to simply call the integrator multiple times.
Search Nedrilad ::

Custom Search