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
thusly:
I 1
i
L i +1 = R i I 0 R 1
L i +1 .
i
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:
=
k
r k ×
F k ,
τ
L i +1
= L i + hτ,
I 1
i
= R i I 0 R 1
,
i
I 1
i
ω i +1
=
L i +1 ,
R i +1
= R i + i +1 .
1.7 Numerical Integration
1.7.1
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