You are on page 1of 2

28/12/13

xna 4.0 - Skinned Model Animation Selection by Key Frames - Stack Overflow
sign up log in tour help careers 2.0

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Take the tour

Skinned Model Animation Selection by Key Frames

I was wondering how I can change the animation of a model using the skinned model processor like the sample from windows in XNA 4.0? I got my model in sucessfully and it plays all the animations in Take 001. How doe I get it to play different parts of the animation based on user input?Like a to jump ect... Everything is the same in the sample from windows but I changed a part in the Animation player like this

/ /S t a r t sp l a y i n gt h ee n t i r e t yo ft h eg i v e nc l i p p u b l i cv o i dS t a r t C l i p ( s t r i n gc l i p ,b o o ll o o p ) { A n i m a t i o n C l i pc l i p V a l=s k i n n i n g D a t a . A n i m a t i o n C l i p s [ c l i p ] ; S t a r t C l i p ( c l i p ,T i m e S p a n . F r o m S e c o n d s ( 0 ) ,c l i p V a l . D u r a t i o n ,l o o p ) ; } / /P l a y sas p e c i f i cp o r t i o no ft h eg i v e nc l i p ,f r o mo n ef r a m e / /i n d e xt oa n o t h e r p u b l i cv o i dS t a r t C l i p ( s t r i n gc l i p ,i n ts t a r t F r a m e ,i n te n d F r a m e ,b o o ll o o p ) { A n i m a t i o n C l i pc l i p V a l=s k i n n i n g D a t a . A n i m a t i o n C l i p s [ c l i p ] ; S t a r t C l i p ( c l i p ,c l i p V a l . K e y f r a m e s [ s t a r t F r a m e ] . T i m e , c l i p V a l . K e y f r a m e s [ e n d F r a m e ] . T i m e ,l o o p ) ; } / /P l a y sas p e c i f i cp o r t i o no ft h eg i v e nc l i p ,f r o mo n et i m e / /t oa n o t h e r p u b l i cv o i dS t a r t C l i p ( s t r i n gc l i p ,T i m e S p a nS t a r t T i m e ,T i m e S p a nE n d T i m e ,b o o ll o o p ) { C u r r e n t C l i p=s k i n n i n g D a t a . A n i m a t i o n C l i p s [ c l i p ] ; c u r r e n t T i m e=T i m e S p a n . F r o m S e c o n d s ( 0 ) ; c u r r e n t K e y f r a m e=0 ; D o n e=f a l s e ; stackoverflow.com/questions/11230803/skinned-model-animation-selection-by-key-frames

1/2

28/12/13

xna 4.0 - Skinned Model Animation Selection by Key Frames - Stack Overflow D o n e=f a l s e ; t h i s . s t a r t T i m e=S t a r t T i m e ; t h i s . e n d T i m e=E n d T i m e ; t h i s . l o o p=l o o p ;
/ /C o p yt h eb i n dp o s et ot h eb o n et r a n s f o r m sa r r a yt or e s e tt h ea n i m a t i o n s k i n n i n g D a t a . B i n d P o s e . C o p y T o ( B o n e T r a n s f o r m s ,0 ) ; } This is how I think I can select which animation based on keyframe or a timespan but I dont know how to actually tell the game to play this part of the animation. Thanks for any help with this
animation xna-4.0

asked Jun 27 '12 at 16:22 MNM 97 8 add comment

1 Answer
It's been a while since you posted the question, but this article I found may still help you or anyone else who is looking to solve the same problem. http://www.visionsofafar.com/DaBlog/post/2009/06/30/XNA-and-Animated-Models-from-Maya.aspx I haven't tried it yet but it looks like a simple and effective solution.
answered Nov 2 '12 at 1:26 Francisco Jimenez 21 3 add comment

Not the answer you're looking for? Browse other questions tagged animation xna-4.0 or ask your own question.

stackoverflow.com/questions/11230803/skinned-model-animation-selection-by-key-frames

2/2

You might also like