How do I rotate individual bones in XNA in a model?
I'm making a game in XNA that is a shooting role-plaing game. I have m开发者_StackOverflowade a human model in Blender and imported it into XNA. I loaded it and can rotate the entire model, but how do I rotate each bone? I tried looking this up on google, but found no good answers.
Check out the simple animation sample in the education section: http://create.msdn.com/en-US/education/catalog/sample/simple_animation
I know it can seem complicated at first, but you really have to stick it with it until you groc it, there isn't too many shortcuts to it.
public void ChangeBoneTransform(int boneIndex, Matrix t)
{
model.Bones[boneIndex].Transform = t * model.Bones[boneIndex].Transform ;
}
Make sure you copy AbsoluteBoneTransforms each time you draw your model
That's it
To rotate use :- ChangeBoneTransform(1, Matrix.CreateRotationX(0.1f)); //in the Update() Method
精彩评论