Game Development Reference
In-Depth Information
or
= x ( t )+ h v ( t ) .
x ( t + h )
This is known as the explicit Euler's method. Another way of thinking of this
is that the derivative is tangent to the curve of x ( t ) at time t . By taking a small
enough step in the tangent direction, we should end up close to the actual solution.
Note that since we are taking a new time step each frame, the frame positions
are often represented in terms of a sequence of approximations x 0 , x 1 , x 2 ,... So
an alternative form for Euler's method is
x i +1 = x i + h x i .
Including the update for velocity, our full set of simulation equations is
v i +1
= v i + h F ( t i , x i , v i ) /m,
x i +1
= x i + h v i +1 .
Note that we use the result of the velocity step in our position equation. This is
a variant of the standard Euler known as symplectic Euler, which provides more
stability for position-based forces. We will discuss symplectic Euler and other
integration methods below in more detail.
1.6.3 Updating Orientation
Updating orientation for a rigid-body simulation is similar to, yet different from,
updating position. In addition to the linear quantities, we now have an object with
the last frame's orientation R i or q i , the last frame's angular velocity vector ω i ,
an inertial tensor I , and a sum of torques τ . From that, we wish to calculate the
current frame's orientation R i +1 or q i +1 and the current frame's angular velocity
ω i +1 .
The orientation itself we represent with either a rotation matrix R or a quater-
nion q , both encapsulating rotation from a reference orientation (much as we can
use a vector from the origin to represent a point). Which form we use depends
on our needs. For example, rotation matrices can be convenient because they are
easily converted into a form efficient for rendering. However, quaternions take up
less space and need fewer operations to update and, thus, can be more efficient in
the simulation engine itself.
Angular velocity is the rotational correspondence to linear velocity. As lin-
ear velocity represents a change in position, angular velocity represents a change
in orientation. Its form is a three-element vector pointing along the axis of ro-
tation and scaled so that its magnitude is the angle of rotation, in radians. We
Search Nedrilad ::




Custom Search