This project is read-only.

Animation Blending Problem

Jul 8, 2010 at 12:16 PM
Edited Jul 8, 2010 at 12:22 PM

I have a model in .X format with two animations, I am able to play these animations individually,but i am not able to blend between them. The two animations i have are idle and turn right. Now when i want to blend between the two animations ,i observe that my model is trying to go back to T-Pose in between and hence deforming the model for second animation. I have gone through your code completely and carefully from the tutorials but i have not been able to solve the problem from quite some time. I am pasting the code below and also please have a look at the screenshot of the actual problem.

    class Alchemist_Animation:IDraw,IContentOwner,IUpdate
        ModelInstance AlchemistModel;
        Matrix wolrdMatrix;
        AnimationController control;
        public AnimationInstance Idle,TurnRight;
        int IdleIndex, WalkIndex;      

        public Alchemist_Animation(ContentRegister content, UpdateManager update,Vector3 position)

            text = new TextElement();
            text.Position = new Vector2(10, -10);

            Matrix.CreateTranslation(ref position, out this.wolrdMatrix);
            AlchemistModel = new ModelInstance();



        public void IntializeAnimation(UpdateManager update)
            control = AlchemistModel.GetAnimationController(); ;
            IdleIndex = control.AnimationIndex("Idle");
            WalkIndex = control.AnimationIndex("TurnRight");

            Idle = control.PlayLoopingAnimation(IdleIndex);           
        public void LoadContent(ContentRegister content, DrawState state, ContentManager manager)
            text.Font = manager.Load<SpriteFont>("Font/Arial");
            AlchemistModel.ModelData = manager.Load<Xen.Ex.Graphics.Content.ModelData>(@"Cloth/Alchemist");
        public void UnloadContent(ContentRegister content, DrawState state)

        public UpdateFrequency Update(UpdateState state)
            if (state.KeyboardState.KeyState.Right.OnPressed)
                if (!TurnRight.AnimationFinished)
                    TurnRight = control.PlayAnimation(WalkIndex,0.5f,0.5f);


            Idle.Weighting = 1 - TurnRight.GetFadeScaledWeighting(state);
            return UpdateFrequency.FullUpdate60hz;
        public void Draw(DrawState state)

            state.PushWorldMatrix(ref wolrdMatrix);
            DeviceRenderState currstate = state.RenderState;
            state.RenderState.DepthColourCull.CullMode = CullMode.None;
            if (CullTest(state.Culler))                
            state.SetRenderState(ref currstate);

        public bool CullTest(ICuller culler)
            return true;            

Here is the screenshot of what exactly is happening. Uploaded with

Jul 10, 2010 at 2:19 AM

That is very odd.

I can't think of anything that could be causing this issue - would you mind sending me the model (if that's OK) and I can take a look.

What happens if you play both animations with a weighting of 0.5?

Jul 12, 2010 at 11:15 AM

Thank you for your reply.

The problem persists even when i play both animation with a weighting of 0.5.

Further more i have sent you a notification through codeplex which contains the rapid share link for the model as you requested.

Jul 12, 2010 at 9:13 PM

I can reproduce this and can confirm it's a xen issue.
The fix may not be simple though, it's a fairly deep problem.

Thanks for sending the model
Jul 15, 2010 at 11:32 PM

For the benefit of others, I've been working away at this and finally figure out the (many!) problems it was exposing.
I'll be putting together a patch tomorrow.