Game Development Reference
In-Depth Information
all the bones have been repositioned. The skeleton is then drawn by
drawing a line from the child to its parent.
Applying BVH files to your single mesh characters
A BVH file stores most data via Euler angle orientations. If you want to
apply these data to your own model then you need top know the default
position of the character. In many instances this will be standing upright
with arms outstretched. Some files, however, record the default position
as arms down to the side. If you are going to apply the motion to your own
object, then you must either model the character to suit the default
location of the mocap data or alternatively be able to conform your model
at frame zero to the mocap position and then apply the rotational motion
on top of the current orientation.
If the rotation matrix for an object at position zero is A and the rotation
matrix for the motion capture data at frame n is B , then the combination
of the two matrices will be AB . To record this to your scene file as Euler
angles you will need to extract the rotation angles from this matrix. If in
your application you normally apply the rotations in HPB order then in
BVH terms this is Z rotation followed by X rotation and finally Y rotation.
This leads to the following matrix:
aa
ab
ac
AB =
ba
bb
bc
ca
cb
cc
cos( h )cos( b ) - sin( h )sin( p )sin( b )
cos( h )sin( b ) + sin( h )sin( p )cos( b )
sin( h )cos( p )
HPB =
-cos( p )sin( p )
cos( p )cos( b )
-sin( p )
-sin( h )cos( b ) - cos( h )sin( p )sin( b )
-sin( h )sin( b ) + cos( h )sin( p )cos( b )
cos( h )cos( p )
Notice that the final term of the second row is -sin( p ). So we can find
the pitch by looking at the arcsin of this value:
p = asin(- bc )
Since we know -sin( p ), we know that - bc
= sin( p ). Using this
information with term ba gives
ba = bc
×
cos( p )