Game Development Reference
In-Depth Information
The Update method is actually implemented by calling three other methods of
CIwAnimPlayer , which we can call independently if we so wish.
The first method is UpdateParameters , which takes the time increment we need to
update the animation by as its sole parameter. This method will update the current
time indexes of all the animations currently in use by the animation player and set
flags to indicate whether those animations have completed or looped.
The UpdateSources method takes no parameters and is used to work out the
current bone orientations for each animation, applying any blending between
animations as required.
Finally there is the UpdateMatrices method, which again takes no parameters.
This performs the final step of converting all the positions and orientations of each
bone into a matrix that will be used to update the vertex stream of the 3D model
during rendering.
These methods need to be called in the order presented previously, but there is no
need to call all three methods in every frame if we do not need the results of that
method to be calculated.
Playing sub-animations
Sub-animations allow us to animate only a part of the entire skeleton, which can
be useful when we want an in-game character to be able to perform two different
actions at once. For example, a character might be able to wield several different
weapons while moving around the game world. The main animation applied to
the character would be an animation for walking, running, or just standing still.
Sub-animations can then be overlaid on top of the main animation to show the
player holding, firing, or reloading the different weapon types.
In order to export a sub-animation, all we need to do is specify the name of the bone
that is the root of the sub-animation in the Sub Anim Root field of the Marmalade
exporter plugin. In the example situation given previously, you might choose to
export the sub-animation starting at a bone that has the two arm bones as children.
The Blender plugin does not currently support this feature unfortunately, though
you could potentially export the entire animation and then delete by hand any
references to bones higher in the hierarchy than the sub-animation root bone in
the ANIM file.
 
Search WWH ::




Custom Search