How do I change animations?

Dec 10, 2012 at 8:28 AM

I'm using the peon model found in the tutorial project and just want to change animations. Currently it is stuck in the Chop animation and I can pause/play it but not sure how to change to the other animations. I tried the following with no luck.

var peon = scene.FindName<Nine.Graphics.Model>("Peon");
            
var animation = peon.Animations["Chop"];
animation.Stop();
            

var idleAnimation = peon.Animations["Idle"];
idleAnimation.Play();

Developer
Dec 10, 2012 at 8:45 AM
Edited Dec 10, 2012 at 11:54 AM

Example:

var model = Parent.FindName<Model>("Dude"); // I did use the peon model here!
            var keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.Space))
            {
                var Ani = model.Animations;
                if (Ani["Chop"].State != Nine.Animations.AnimationState.Playing)
                    Ani.Play("Chop");
            }
            else
            {
                var Ani = model.Animations;
                if (Ani["Run"].State != Nine.Animations.AnimationState.Playing)
                    Ani.Play("Run");
            }
Dec 10, 2012 at 9:52 AM

Great, thanks.