Game Development Reference
In-Depth Information
If you look at the preceding equations, you will realize that to calculate the exact
location of a wrist in the world space, we need to calculate the position of the elbow
in the world space first. To calculate the position of the elbow, we first need to
calculate the position of shoulder. We need to calculate the world space coordinate of
the parent first in order to calculate that of its children. Hence, we use depth-first tree
traversal to traverse the complete skeleton tree starting from its root node.
1
2
7
9
3
4
8
5
6
Depth-first tree traversal order
A depth-first traversal begins by calculating modelMatrix of the root node and
traverses down through each of its children. A child node is visited and subsequently
all of its children are traversed. After all the children are visited, the control is
transferred to the parent of modelMatrix . We calculate the world matrix by
concatenating the joint parent's world matrix and its local matrix. The computation
of calculating a local matrix from DOF and then its world matrix from the parent's
world matrix is defined as forward kinematics.
Let's now define some important terms that we will often use:
Joint DOFs : A movable joint movement can generally be described by six
DOFs (three for position and rotation each). DOF is a general term:
this.position = vec3.fromValues(x, y, z);
this.quaternion = quat.fromValues(x, y, z, w);
this.scale = vec3.fromValues(1, 1, 1);
We use quaternion rotations to store rotational transformations to avoid issues
such as gimbal lock, as explained in Chapter 5 , Camera and User Interaction . The
quaternion holds the DOF values for rotation around the x , y , and z values.
 
Search WWH ::




Custom Search