This project is read-only.

problem in animation blending

Oct 9, 2010 at 6:32 PM
Edited Oct 9, 2010 at 6:54 PM


i have an animated character which has some 5 animations like(stand in idle, sit, reach for tv remote, take remote(with remote stuck to the hand after reaching and getting back to sitting pose), and watch tv with remote)  

now my problem is to get these animations to blend one after the other. After going through the tutorials in xen , i used tutorial 11. so far the only problem im getting is the improper blend where the character blends to the next animation with a bone pose added in between...

and here is the code ....

public AnimationController animationController;
public AnimationInstance prevAnimation,currentAnimation;


prevAnimation = animationController.PlayAnimation(animList[0], 0.5f, 0.5f); //PlayLoopingAnimation(animList[0]);

protected override void Update(UpdateState state)
  if (state.KeyboardState.KeyState.Right.OnPressed)
     playAnimation = true;
          if ((!actor.prevAnimation.AnimationFinished))
                 if (!actor.currentAnimation.Enabled)
                    actor.currentAnimation = actor.animationController.PlayAnimation(actor.animList[currentIndex], 0.5f, 0.5f);
                animationTime = actor.currentAnimation.AnimationDuration;
                    totalElapsedTime = actor.currentAnimation.Time;

                if(totalElapsedTime > animationTime *0.5f)
                    actor.prevAnimation = actor.currentAnimation;
                    currentIndex += 1;
                    if (currentIndex >= 5)
                       currentIndex = 0;
                    actor.currentAnimation = actor.animationController.PlayAnimation(actor.animList[currentIndex], 0.5f, 0.5f);

              actor.currentAnimation.Weighting = 1 - actor.prevAnimation.GetFadeScaledWeighting(state);

so how do i blend between the animations thus avoiding bone pose.

and i have reset to currentIndex to zero just for testing purpose. actually the last animation needs to be looping for a while and then the character should come back to standing and stand idle pose ..