This project is read-only.

Model Blending Issues still present in 1.8.2?

Sep 11, 2010 at 10:02 AM


I just downloaded the latest release version (1.8.2) and started to play with model blending.  While watching the tutorial for the Animation Stress Test, I noticed that many of the models became deformed while switching from idle to walk/run.


To test my suspicions, I opened the model animation and added the following bit of code in the actor class:


	class Actor : IDraw, IContentOwner
		private ModelInstance model;

		private AnimationController animationController;
		private AnimationInstance animation;
                private AnimationInstance animation2;

		public Actor(ContentRegister content)
			model = new ModelInstance();
		        animationController = model.GetAnimationController();


			int animationIndex = animationController.AnimationIndex("Walk");
                        int animationIndex2 = animationController.AnimationIndex("Jog");

			//begin playing the animation, looping
			animation = animationController.PlayLoopingAnimation(animationIndex);
                        animation.Weighting = .5f;
                        animation2 = animationController.PlayLoopingAnimation(animationIndex2);
                        animation2.Weighting = .5f;

reset of the code is the same from here on...
Here was the result I got after performing the above code:

Does anyone else experience this?  I wanted to be able to blend my animations from idle->walk->run->walk->idle without these weird transforms occurring between each one.



Sep 21, 2010 at 2:57 PM

Sadly, yes, I have experienced this as well, even after having moved the weighting code to a separate method that sets the weights using a formula. This may be because my weighting code is still wrong though.
Here it is anyway.

 public void SetupWeights(DrawState state)
            Punch.Weighting = !Punch.AnimationFinished ? 1 : 0 - (1 - Walk.Weighting - Stance.Weighting - HeadHit.Weighting);
            Walk.Weighting = (1 - Punch.Weighting - Stance.Weighting - HeadHit.Weighting);
            Stance.Weighting = (1 - Punch.Weighting - Walk.Weighting - HeadHit.Weighting);
            HeadHit.Weighting = (1 - Punch.Weighting - Walk.Weighting - Stance.Weighting);

And I call that method in the Draw method