Wednesday, July 25, 2018

xna 4.0 - How do you add equipment to a 3D character model using XNA/Blender?



I've watched quite a few Blender tutorials, but I have yet to see examples of how to swap out sub-models. So my question is, how do you swap out equipment on a character model? Specifically I’d like to be able to dynamically add/swap clothing and items held by a character model in XNA. Ideally the items would follow the bone structure of the character model.


For example; starting with a naked character in XNA, I’d like to be able to have the character hold an axe and wear chainmail that follows the character’s animations. I’d also like to be able to switch this equipment for a sword and plate mail at any time during the game. I’d rather not create a model for each equipment combination. Is there some way to just add the bones (say a sword bone) and meshes of one model to another model bone (say a right hand bone)?


Thanks…



Answer



For items that are carried by the character like a sword, shield or similar, you can create a special hand-bone, where you attach the new item/geometry at runtime.


When it comes to different armors/clothing, this is going to be slightly more complicated. An approach that is widely used (I think also by WoW) is using segmented models:


You model your character with all different armor and cloth-pieces as sub-meshes (in blender, you would use vertex-groups for that). Then you just toggle the visibility (or attach) the needed parts and hide (or detach) the unneeded parts. All the parts will share the same skeleton.


You can also achieve a lot of different looks by just swapping the texture.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...