//load the avatar public Avatar(ContentRegister content, UpdateManager update) { //create a random avatar description... Microsoft.Xna.Framework.GamerServices.AvatarDescription description; description = Microsoft.Xna.Framework.GamerServices.AvatarDescription.CreateRandom(); //Create the avatar instance avatar = new AvatarInstance(description, true); //Create the animation controller. animationController = avatar.GetAnimationController(); //NOTE: Animations cannot be played until the avatar animation data has been loaded... content.Add(this); // this will call LoadContent update.Add(this); //At this point in this tutorial, the animation is now loaded. //get the index of the walk animation int animationIndex = animationController.AnimationIndex("Walk"); //begin playing the animation, looping walkAnimation = animationController.PlayLoopingAnimation(animationIndex); }
internal AvatarAnimationController(UpdateManager manager, AvatarInstance parent) : base(manager, parent) { this.boneList = new Matrix[Microsoft.Xna.Framework.GamerServices.AvatarRenderer.BoneCount]; if (parent == null) throw new ArgumentNullException(); this.parent = parent; transformedBones = new Transform[Microsoft.Xna.Framework.GamerServices.AvatarRenderer.BoneCount]; transformIdentity = new bool[Microsoft.Xna.Framework.GamerServices.AvatarRenderer.BoneCount]; for (int i = 0; i < transformedBones.Length; i++) { transformedBones[i] = Transform.Identity; transformIdentity[i] = true; boneList[i] = Matrix.Identity; } this.transformOuput = new AnimationTransformArray(transformedBones); }