Game Development Reference
In-Depth Information
The final piece is the calculation of I i . The problem is that I is calculated
relative to the object, but the remaining quantities are computed relative to the
world. The solution is to update I each time step based on its current orientation
I 1
L i +1 = R i I 0 R 1
L i +1 .
We can think of this as rotating the angular momentum vector into the object's
local orientation, applying the inverse inertial tensor, and then rotating back into
world coordinates.
This gives us our final formulas:
r k ×
F k ,
L i +1
= L i + hτ,
I 1
= R i I 0 R 1
I 1
ω i +1
L i +1 ,
R i +1
= R i + i +1 .
1.7 Numerical Integration
Issues with Euler's Method
Euler's method has the advantage of simplicity, however, it has its problems. First
of all, it assumes that the derivative at the current point is a good estimate of
the derivative across the entire interval. Secondly, the approximation that Euler's
method produces adds energy to the system. And this approximation error is
propagated with each Euler step. This leads to problems with stability if our
system oscillates, such as with springs, orbits, and pendulums, or if our time step
is large. In either case, the end result is that our approximation becomes less and
less accurate.
We can see an example of this by looking at Euler's method used to simulate
an orbiting object ( Figure 1.8) . The first time step clearly takes us off the desired
path, and each successive step only makes things worse. We see similar problems
with so-called “stiff” equations, e.g., those used to simulate stiff springs (hence
the name).
Recall that the definition of the derivative assumes that h is infinitesimally
small. So one solution might be to decrease our time step: e.g., divide our time in
half and take two steps. While this can help in some situations (and some physics
Search Nedrilad ::

Custom Search