• Advertisement
Sign in to follow this  

Mesh swap in XNA Animation

This topic is 1871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am learning how to skin meshes (never have I done it, so I think it's high time o.O), I am using ported XNA Animation Component Library to XNA 4.0. Everything works fine except one thing. I want to be able to swap meshes inside a model (for instance, say my character is a sword master, and I want to change his weapon in hand). I noticed that XNA animation requiers for all objects in my file to have weights (which I am not sure about). I am also using custom effects.
So do you have any ideas how to change mesh inside model with XNA animation (i.e. swap it with mesh from other model)?
I also want it to be animated so I need to create animation inside character model for my weapon smile.png
Solved it, took me a lot time yesterday to search the internet and after posting a topic on gameDev i solved it in few minutes :)
For those who want to do same thing as I do and don't know how:
In my weapon file I created a bone named the same way as in my character model and I added skin modifier to the weapon and added that bone(I am not sure if it is required). then in XNA:
sword.World = character.modelAnimator.GetAbsoluteTransform(character.modelAnimator.BonePoses["weapon"].Index) * character.World;
(sword and character are objects of my class to store info that I use, like materials, animations etc.).
I also add a flag for proxy weapon in character model to not draw it :) Edited by Tasaq

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement