col0498
col0498
L space. Quaternion space is like the space between the handout desk and
the deal room at any booth of any publisher at E3. It’s a concept you can
grasp, but it’s really tough to visualize being there.
As you’ll recall, I finished up with an
OpenGL application that converts Euler
angle data to quaternions and then dis-
Clearly, the problem revolves around
the interpolation of the arm positions.
hypersphere. If I were simply to inter-
polate between the two keyframes in a
straight line, I would be cutting across
13
plays the results. Now I want to extend the arc of that sphere (Figure 1a). As
this application to allow for the inter- Interpolation you can see, in-betweens that are even-
polation of two keyframed positions. It ly spaced on the hypersphere create
struck me that I should create a custom s I discussed last month, one of nonlinear positions on the LERP-line.
3D first-person interface that effectively
demonstrates interpolation.
A the key benefits of using a quater-
nion representation is the ability to
Alternately, the effect of evenly spacing
out in-betweens along the LERP-line
interpolate between keyframes. Nick would create an animation that would
Bobick, in his article in the February appear to move faster as it traveled
The Task 1998 issue of Game Developer, discussed across the middle of the interpolation
interpolation of quaternions (“Rotating (Figure 1b). This may not always be a
s the project technical lead, I am Objects Using Quaternions,” pp.38-39). bad thing, so it’s quite easy to adjust
A asked to create an interface for a
first-person fighting game. However,
Bobick described the use of Spherical
Linear Interpolation (SLERP) to achieve
between LERP and SLERP.
The code in Listing 1 gives me the
the design calls for allowing the player smooth interpolation. For very small basis for creating my 3D interface. By
to create custom attacks in some sort of interpolation, he mentioned that it’s a applying these routines to a three-
pregame editor. The player does this by good idea to use simple Linear bone hierarchy, I get a smooth attack
manipulating an arm consisting of an Interpolation (LERP). Being the hard- from any two keyframed positions. To
upper arm, a lower arm, and a hand core game programmers that you are, implement this in OpenGL, I only
with a weapon. The player positions you may ask, “Why not use LERPs all needed to modify my display routine a
this arm into two poses. One pose is the time and avoid the expensive math little bit. The critical section is in
the beginning of the attack move and that SLERPs require?” The reason is that Listing 2, and you can see the results
the other pose is the end of the attack unit length quaternions describe a 4D in Figures 2a-c.
move. During the game, this custom
action is triggered and creates a smooth
attack. The player’s effective use of this
interface determines the effectiveness
of the move. Several of these moves are
then combined to create a unique
fighting experience.
Alright, so it’s not revolutionary, but
it’s a well-defined task with a pretty
clear path of attack. As technical lead, I
like that. So how do I get started?