------------------------------------------------------
Animation Tutorial for Second Life Animations
This document is an attempt to categorize and describe a number of issues related to animations in Second Life that are not obvious from the documentation provided by the Forums and Wiki’s to which we must go to get the information and piece it together. This is not definitive, but descriptive. The user will still have to go to the animation software, LSL and Second Life itself to experience how it all works, but I hope this helps.
Creating Animations for SL
• The .BVH file format
Animations are imported into Second Life from the outside world using the .BVH format. This file format is the Biovision hierarchical data format and a detailed description of the format can be found at http://www.cs.wisc.edu/graphics/Courses/cs-838-1999/Jeff/BVH.html
In short, the BVH file defines the size and shape of the avatar, the length of the various distances between joints and the angles of the joints relative to one another in the various stages of the animations.
There are a number of products, some of them free and others that one must pay for that can create these files by visually manipulating the avatar in a sequence of steps that represent the animation. After the animation is created, the .BVH file is exported from the animation software and imported to Second Life through the File/Upload Animation menu pick. The scope of this document does not cover the various details of creating the animation in these products, but only the general understanding and “rules” that one must follow in order to create the animations and have a successful upload and implementation in Second Life.
Each animation consists of a number of “frames” that are implemented in a time sequence to give the appearance of movement, much like a movie or video. It is important to understand the use of frames in any of these software packages and even have a rudimentary understanding of them to import properly into Second Life.
For more information on animations software, look into products called Avimator (free), QAvimator (free), SLAT (free) , Poser ($$), and Blender (free Opensource)
• Understanding the frame one T-Pose (This section has been edited to reflect new studies done on the Frame 1 issue, 4/2/07)
Itt is possible to create an animation where only certain joints are actually included in the animation. SL uses the first and second frame of the animation to determine which joints of the animation will actually be included in the animation. It does this by noting the difference between the two frames. If there is no change between frame 1 and frame 2 for a specific joint, then that joint is not included in the animation.
It is important to understand that frame 1 is never seen when the animations is played back in SL, so it can be anything. Many aimators use the "T-Pose" in frame one as a standard way of starting an animation, but this is not actually necessary.The perfect T-Pose is where the avatar is fully zeroed out – that is, every component of every angle between every joint is set to zero.
However, it is not NECESSARY to have the T-Pose in frame 1: What IS necessary is that when you upload, SL will decide which joints you want in your animation based on whether that joint in frame 1 is different from the same joint in frame 2.
This is a critical concept: I have found the easiest way to do this is make your animation starting at frame 2. When you are all done, copy frame 2 to frame 1. Then go back to frame 1 and change any joint that you DO want to be part of the animation. (Please understand that just putting in a T-Pose may not do this for every joint, unless you know you actually moved every joint in frame 2.)
An important exception to this rule is this: If the hip joint in your animation is displaced from the T-Pose hip joint (e.g. your avatar is sitting down on the ground), then the Hip joint in frame 1 must be as if the Avatar is standing and the hip joint in frame 2 must be where you want the animation to start. If you do not do this, then SL interprets the hip joint is such a way that your avatar will do a great swoop into frame 2 in a very jerky fashion each time you initiate the animation.
When you upload the animation, SL only includes those joints you changed in the actual animation. This is extremely useful to understand and allows you to make animations that only move PART of the avatar.
EXAMPLE
Suppose you want to make a pose of an avatar carrying a teddy bear in her right arm, but you want the avatar to walk and fly and
move her head when you move the cursor.
1) Create a 2 frame animation of you holding the bear with both arms.
2) make sure that frame 1 and frame2 are idendical
3) Go to frame 1 and change all the vectors for the left and right
arms that hold the bear to <0.0, 0.0, 0.0>.
The arms will look like the T-Pose.
4) Save the animation as a .BVH file and
If you don;t want typing to override the holding
upload the animation at Priority 3
If you DO want typing to override the holding animation
Upload the animation at priortiy 2
Set the looping checkbox and set the start looping
valued at 100% and ending at 100%
Set a suitable initiation time. I like .70 secs,
but this is a matter of taste.
When you play the animation - the default animations of SL will over-ride everything except the right arm and the avatar will
carry teddy around all day without dropping him or going wacko when you type, if you have set the priority at level 3.
Now suppose you want to Tickle teddy every once in a while with you left hand. To do this you want to over-ride the carrying
animation with a tickle animation:
5) Create a second animation of your tickling action.
6) Make sure frames 1 and 2 are identical
7) Go to Frame 1 and change all the joints of the left arm to some other value. This allows SL to know that the
only thing that should happen differently when you initiate Tickle, is the left arm will go into action, but the rest of the
avatar will do whatever it is already doing.

than the holding animation. so:
If you want typing to override the left arm - Priority 2
If you want typing to NOT override the arm - Priority 3
DO NOT CHECK the looping box - you want the tickle to play once and then stop.
Set a suitable initiation time.
9) Play the holding animation - the avatar will raise its right and left arms to hold the bear and stay there.
10) Play the tickling animation. If everything is working, the left hand should break out of the holding pose,
tickle the bear and then when the ticling is over, will return to the holding position.
using these techniques, you can create many useful animations and overlay animations to be used with SL avatars.
• The Unique Hip
The Hip body part in the .BVH definition is unique. It is the only body part that not only has rotation, but has an XYZ location in space. This XYZ location can be used very effectively to displace the avatar from the actual location of the place where the animation is started.
When an avatar “sits” on a prim in SL, where it is relative to the prim is defined by the llSitTarget call in the Linden Scripting Language (LSL) script and the vector and rotation offsets define the relative location of the avatar’s hip joint from the center of the prim. Using these offset values, the programmer can define exactly how the avatar will sit relative to the prim when it “Sits” on the prim. Once these values are set in LSL, they cannot be changed while the avatar is seated on the prim. However, the Hip offsets and rotations contained in the animation, can make the avatar move around on the prim. This is what happens in dance animations where the avatars move during the animation. What is actually changing is the hip offsets in the animation relative to each other and to the pose balls or other sit targets.
• How limbs are connected
With the Hip location and rotation defined, all the other body parts are connected back through the each other to the hip. For example, there is a chain that goes like this: hip, abdomen, chest, right collar, right shoulder, right forearm, right hand
If you move the hip, either by rotation or translation, all this chain moves with it. If you move the right collar, then the right shoulder, right forearm, and right hand move with it. This is true for all body parts and they all connect back to the hip in the end.
With this in mind, if you want to move the left hand to a certain place, you have to set up all the parts on the way out to the hand in order to get a realistic animation with the hand in the right place.
It is important to understand that the BVH file is only recording the angles between joints. When the file is imported into SL, all these angles are applied to the avatar, regardless of size with no scaling. This means that a hand that is perfectly placed in your animation software, when applied to an avatar with long arms, may be seriously displaced when applied in Second Life. There are compensation schemes to mitigate this that will be discussed below in “Dual Animations”
• Inverse Kinematics (if you can get them)
Some animation packages tout Inverse Kinematics. This simply means the ability to place the avatar’s hand where you want it and the other joints along the way adjust to fit it. This is a huge time saver and accuracy saver if it is available, but does not resolve the issue of the scaling that happens when you import it to Second Life. It only helps create the animation, but does not change the fact that you are still importing into a world with an unknown scale.
• Avatar Sizes
Because Avatar sizes vary greatly, it can be very challenging to create animations that fit to real objects in SL. The Default avatars in the various programs for creating animations are of unknown size and do not correlate easily to the variety found in SL. In SL, one can lengthen and shorten the legs, arms, torso, shoulder width and neck independently. Typically, most people do not get too weird with their avatars and generally resort to simply scaling their height to be what they want. In SL the avatars all seem to be tall, but there is still a general sense that females tend to be smaller. I have found that the typical female avatar ‘s eyes are about chin level with the typical male. The animation program SLAT allows the designer to scale avatars relative to one another for the development of custom animations, allowing the designer to get dual animations much more lined up with one another when imported into SL.
Importing Animations
• Understanding the way Animations are played in Second Life
When an animation is played in Second Life, it goes through up to 5 distinct phases depending on how it is implemented. The designer has a number of options that determine how this is done and all of them need to be set up at WHEN the animation is uploaded and cannot be changed after they are are.
The five possible phases are (These are my own names)
Ease-In -- AnimationStart -- AnimationLoop -- AnimationEnd -- Ease-Out
Ease-In is a transition phase that moves the avatar from the point at which the animation is initiated to the first visible frame of the animation. It is not actually part of the animation. Suppose your avatar is lying on the ground and you initiate an animation to start her walking. The Ease-In is an SL-generated motion that carries the avatar from the laying down position to the position of the first visible frame of your animation. This is done with some magic algorithm within SL and is not always graceful or well controlled. The time that it takes to do this is set by the time in the “in” box of the upload dialog in seconds. The animation designer has to think ahead of time about how the animation will be used to maximize the effect of this Ease-In period. If it is too short, the avatar will jump to the new position. If it is too long, it can be awkwardly slow. This value cannot be reset later without uploading the animation again.
Ease-Out is a transition phase that moves the avatar from the last frame of the your animation to the next animation or to some default animation or pose when the playing animation ends. This time is set with the “out” box and cannot be changed without uploading the animation again. It is not part of the animation and is controlled by SL in the same way as the Ease-In phase.
Animation Start is a phase that is actually part of the animation stream that is being uploaded. The length of it can range between 0 and 100% of the whole animation. This percentage determines the portion of the animation that comes before animation looping and will NOT be included IN the animation looping. Suppose you have a walking animation where there are 50 frames. The first ten frames (20%) are the first step from standing upright and then the rest of the frames want to be looped over and over in a smooth walking motion. Set the Animation Start to 20.0%. The first 20% will start after Ease-In but will never be repeated. The animation will loop between the Animation Start and Animation End values.
Animation End is a phase that is actually part of the animation stream that is being uploaded. The length of it can range between 0 and 100% of the whole animation. This is the part of the animation that should play when the animation stops looping. Suppose you have a walking animation where there are 50 frames. The first 5 frames (10%) are the first step and then frames 6 to 45 want to be looped over and over in a smooth walking motion with the last 5 frames (10%) set to be the last step where the avatar comes to a stop gracefully. Set the Animation Start to 10.0%. The first 10% will start after Ease-In but will never be repeated. Set the Animation End value at 90%. The animation will loop between the frames 5 and 45 and when the animation is told to stop using llStopAnimation, the last five frames will be executed followed by the Ease Out phase.
Looping is the phase between the “in” percentage value and the “out” percentage value and is the portion of the animation that will loop continuously if the loop check box is checked when you upload the animation to SL. If the Loop check box is not checked at upload, then the looping section will be executed exactly once.
If you want an animation to play once and then hold at the end until you tell it to do something else (typical of a single frame "Pose"

NOTE: The Ease-In and Ease-Out are not reliable. It seems that sometimes SL decides to skip them altogether, though this may be a result of graphics lag or SL lag in general and the whole Ease-In or Ease-Out time may actually be there but because of lag, it seems to skip over it. It is not clear whether this is a client side or SL side issue.
• Setting Priorities at Upload
Each animation has a priority associated with it. The Priorties in SL range between 1 and 4. Priority 4 is higher than 1. An animation with a higher priority will override a lower priority animation if invoked. An animation with an equal priorty as an existing animation will override the existing. The priority for your animation MUST be set at upload and cannot be changed unless the animation is uploaded again.
If the individual joint is not perturbed in the initial T-Pose (see T-Pose, above) then the priority for that joint is lowered so that existing animations or new animations of lower priority can override only those joints (See discussion of T-Pose above)
It is important to understand that an avatar can have many animations or poses running simultaneously. The one with the highest priority or, if of equal priority, the most recent, will be the one that is playing. So, it is possible to have a 50 sec animation and 10 seconds into it, override it with a 15 sec animation. When the 15 sec animation ends, the 50 sec animation will still be playing and will take over. High priority animations with unperturbed joints can be over ridden only in those joints by other animations.
Creative initiation of well crafted animations can create some very unusual effects including the overlaying of expressions such as smiling or frowning in the midst of an animation. All this timing is left up to the scripting in LSL and is beyond the scope of this writing.
Playing Animations in Second Life
• Using the Animation Dialogue
An animation in your SL inventory can be played by simply double clicking on it and by hitting the buttons in the dialogue box. This is the simplest method of just testing and observing and animation once it is uploaded. It has little value other than just seeing what a specific Animation does.
• Linden Scripting Language (LSL)
The Linden Scripting Language has a number of calls that allow the scripter to string animations together to create wonderful effects. SL has a number of canned standard animations for standing, sitting, sitting cross legged, smoking, laughing, etc. that can be found listed in the LSL Wiki. These can be called by simply using their name as a string in any of the LSL calls. Each of these canned animations has a defined priority so the designer can know how to use them effectively with other animations. (See the LSL Wiki for this list of animations and priorities)
The following calls to LSL are useful in arranging effective animations. Use the LSL wiki to get specifics on the implementation and use of these calls. I will discuss briefly here some things that are not clear that will help understand how to use them effectively:
o llStartAnimation – this will initiate a named animation for an avatar even if another animation is already or still playing. Whatever the previous animation is doing, it will interrupt it at the instant that llStartAnimation is invoked and will take into account all the priorties. It will start with the Ease In phase (see above) and transition the existing animation into the new animation according to the length of the Ease In phase set at upload. The first animation will continue to run, it will just be over-ridden.
o llStopAnimation – This will stop the named animation. The animation will stop and the Animation End and Ease Out phases will transition the animation to whatever was playing before, or if it is ended, to a SL default animation. This can have very interesting effects if not well understood. Customarily, in multiple animation designs, the designer will stop an animation that is not needed so that when the new animation ends, the results are predictable.
HINT: Because multiple animations can run simultaneously, if you stop an animation before starting a new one, SL begins to transition the stopped animation to some default for an instant before starting the new animation. This can make the transition very sloppy. A good practice is to start the new animation and THEN stop the old animation after some period of time. This will create a smooth transition to the new motion or pose. The code fragment below shows how to do this in code without slowing down the main program by puttint the removal of the old animation in a timer. The Stop time should be longer than the Ease-IN phase of the new animation.
DoAnimation(NewAnim) {
if (NewAnim != CurrentAnim ) {
llStartAnimation(NewAnim);
StopAnim = CurrentAnim;
llSetTimerEvent(1.0); // The timer terminates the existing animation after 1 sec
CurrentAnim = NewAnim;
}
}
timer() { // the timer removes old animations from the animation list
llStopAnimation(StopAnim);
llSetTimerEvent(0.0); // stop the timer
}
o llGetAnimation – this command does not get the currently overlaid animation but actually retireves the underlying SL default animation that would be in control if the avatar had no overlay animations. So if the forward arrow is being pressed, this will return “walking” or if the avatar is flying with no motion, it will return “hover”. This is useful because you can change what your avatar is doing when the SL mode changes. This is how the animation over-riders work. They simply detect when buttons are pressed, get the default SL animation name and then tell the script to over-ride “walking” with a higher level “sexy-walk” animation.
o llGetAnimationList – This call returns a list of all the playing animations, including over-riding user animations. It is useful for finding out when animations you have started have actually ended.
By carefully stacking and sequencing animations, one can create smooth lifelike transitions and many subtle effects and the only limit is the understanding of the concepts listed above and your cleverness in implementing them in LSL.
• Expressions
SL supplies a number of expressions that can be superimposed on animations. These include smiling, sticking out your tongue, frowning, winking and a number of others. These expressions are superimposed on the existing pan-faced animation that we know and love. They are initiated and then fade rather quickly and to sustain them they must be initiated in a loop. They are not confined by the priorities or body position of the existing poses and they are NOT defined in the BVH file, but rather added real time in the animation script.
Expressions are listed in the LSL wiki and are controlled by the llStartAnimation and llStopAnimation calls just like animations. Expressions cannot be created outside of SL at this time
So if you want an avatar to turn and face a partner, then stick out his tongue – you have to play the turn-to-face-partner animation and then play the express_tongue_out expression over it at the right time using the llStartAnimation(“express_tongue_out”) call.
Dual Animations
One of the great challenges in animations is getting animations to relate to one another in lifelike ways. I prefer the SLAT program for this task. The developer of SLAT recently added a number of features so that animators can reliably tie two avatars together at a specific distance and develop interactive animations that are reliable and effective.
SLAT also allows the animator to scale the avatars to more realistic sizes. In developing a series of animations for a dual avatar walk together/fly together vehicle, I was able to make one avatar such that the top of the head was level with the mouth of the other. When the two interact in the program, I was able to place hands, limbs, hips, faces in appropriate relationship to one another without all the guess work I had when I was developing in a program that did not allow this.
The animations came out well matched and very effectively. The perfection of all this is ongoing and remains one of the greater challenges to effective animation in SL.