Game Development Reference
In-Depth Information
1
2
3
4
Figure 2.3. A sequential impulse solver can cause an aligned box falling flat to the ground
to bounce off with rotation.
warm starting is being used. Full warm starting can give a springy, oscillating
behavior and prevents stacks from ever falling asleep. Because of this, the cur-
rent frame's impulses are usually initialized with only a fraction of the previous
frame's impulses. As we increase this fraction, the solver becomes more springy,
but it can also handle stacking better. It could be worth experimenting with this
to find the sweet spot.
2.5.3 Who Is Tilting My Box
A sequential impulse solver, as described above, is called in mathematical terms
Gauss-Seidel iteration. Another method is Jacobi iteration, in which all contact
points are solved independently, and then the resulting impulses are applied all at
once, hence removing the sequential in sequential impulse. Jacobi solvers have
some nice properties, especially when it comes to parallelization, but they gener-
ally take way more iterations to converge. One effect of sequential contact solving
is that symmetric problems often have seemingly unpredictable solutions. Con-
sider a perfectly aligned box dropped on a horizontal plane. All four corners hit
the plane at the same time, even forming four identical contact points. A sequen-
tial impulse solver will start solving one contact point without considering the
other three, apply the resulting impulse and then consider the next one. While
solving the second contact, the problem is no longer symmetric, since the box is
rotating after applying the first impulse. The resulting motion will behave as if
one corner of the box hit the ground slightly before the others (see Figure 2.3 ) .
Hence, whenever we see this type of behavior, it is most likely not an error, just
brother Gauss-Seidel pulling a prank.
2.5.4
Friction
Friction is usually a little trickier than nonpenetration constraints since the max-
imum applied force depends on the normal force. The more pressure there is on
an object, the better it sticks. This interdependence results in a nonlinear problem
that is very tricky to solve accurately.