It is been a long time since i searched to the first time how to do a keyframe animation in Xna, and occurs me to make another way, so i use bone animation in a simple way, emulating the behavior of a simple keyframe animation.
Preparing the model
For example, i wanna create a simple scene of a little ball scaling, but you can rotate and translate if u wich
I put a bone right in the middle of the sphere and add a skin modifier, create a simple animation and export
Indeed create a keyframe animation for games is a pain option, because the model will have all the vertices repeated N times where N is the number of animations, and if u use bone animation, of course you will lost some functionalities but the main features of an animation will be preserved and you will have the performance gain of only interpolate one bone.
AnimatedModel am = new AnimatedModel(factory, "..\\Content\\Model\\animation", "..\\Content\\Textures\\White"); ///Inicializa o Controlador (Idle eh o nome da animacao inicial) AnimatedController arobo = new AnimatedController(am, "simple"); GhostObject pobj = new GhostObject(Vector3.Zero,Matrix.Identity,new Vector3(1)); arobo.isLoop = true; ///Cria o shader e o material animados DeferredSimpleAnimationShader sas = new DeferredSimpleAnimationShader(arobo); DeferredAnimatedMaterial amat = new DeferredAnimatedMaterial(arobo, sas); IObject ball = new IObject(amat, am, pobj); World.AddObject(ball);
This is a simple alternative to the keyframe animation problem. I hope i can help anyone with this.
Download it here