public AnimTest(GameSession.GameSession RuningGameSession) : base(RuningGameSession) { this.model = new AnimatedModel("test2/Victoria-hat-tpose"); this.model.LoadContent(this.RunningGameSession.Content); base.model = this.model.model; dance = new AnimatedModel("test2/Victoria-hat-dance"); dance.LoadContent(this.RunningGameSession.Content); // Obtain the clip we want to play. I'm using an absolute index, // because XNA 4.0 won't allow you to have more than one animation // associated with a model, anyway. It would be easy to add code // to look up the clip by name and to index it by name in the model. AnimationClip clip = dance.Clips[0]; // And play the clip AnimationPlayer player = model.PlayClip(clip); player.Looping = true; // this.Rotation = new Vector3(0.0f, 0.0f, (float)(Math.PI/2)); }
public static Model AddModel(string modelPath, float loopBlend, string key = "") { modelPath = modelPath.Replace(G.I, '/'); if (key == "") { key = modelPath.Substring(modelPath.LastIndexOf('/') + 1); } Model model = content.Load <Model>(modelPath); models.Add(key, model); AnimatedModel anim = new AnimatedModel(key); anim.LoadContent(RenderMethod.Diffuse); anim.MakeLoopBlend(loopBlend); return(model); }