[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Written by Michael Voase, mvoase@midcoast.com.au.
Please note this document is not complete as yet. The examples given are not 100% checked and verified.
In this section we will be exploring the second method of sprite animation, skeletal animation. The Crystal Space sprite contains a number of interfaces and data structures that allow you to control your sprite on a limb by limb basis. Additionally, the `skel3d' module also transparently updates and applies the animation transforms on the skeleton of the sprite for you. To accomplish this feat of wizardry, the skeleton employs a number of embedded interfaces that permit the rapid updating of skeletal information. However, before we can begin, first we must define a skeleton for our sprite.
The sprite skeleton is a fairly simple structure. The most notable difference from a frame is the addition of connections with embedded transforms that permit the attached bones to be translated and transformed about the connection point. Each limb of the skeleton has a number of attached vertices which are transformed under the influence of the connection transform. The declaration for an articulated sprite is very similar to a frame animated sprite, with the notable exception that an articulated sprite usually contains one frame. You can use multiple frames if you want, I don't believe there is a restriction at all, however, generally, a single frame is sufficient. We will start with an identical sprite to our previous example, then add an appendage to it. The appendage will be the same in shape, but inverted and touching the lower appendage by a single point. We will then add an animation to make the top pyramid wobble backward and forward.
<meshfact name="fact"> <plugin>crystalspace.mesh.loader.factory.sprite.3d</plugin> <params> <material>white</material> <frame name="the_frame"> <v x="0" y="0" z="0" u="0" v="0"/> <v x="0" y="1" z="0" u="0" v="0"/> <v x="1" y="0" z="0" u="0" v="0"/> <v x="0" y="0" z="1" u="0" v="0"/> <v x="0" y="2" z="0" u="0" v="0"/> <v x="0" y="2" z="1" u="0" v="0"/> <v x="1" y="2" z="0" u="0" v="0"/> </frame> <t t1="0" t2="2" t3="3"/> <t t1="0" t2="3" t3="1"/> <t t1="0" t2="1" t3="2"/> <t t1="2" t2="1" t3="3"/> <t t1="4" t2="6" t3="1"/> <t t1="4" t2="5" t3="6"/> <t t1="5" t2="4" t3="1"/> <t t1="6" t2="5" t3="1"/> <action name="default> <f name="the_frame" delay="1000"/> </action> <skeleton name="skel"> <limb name="top"> <v>1</v> <v>4</v> <v>5</v> <v>6</v> </limb> </skeleton> </params> </meshfact> |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |