Modular Character Setup

What is the most efficient way to create a modular character setup in C# so that I can switch out body parts? Each body part that I have has the full body skeleton, the only difference between each part is the mesh visible. So if I wanted to switch heads I would apply the animation to another head and overlay it over the original body.

If there is a better way, please let me know. I just need the ability to switch out body parts while the animation is running.

Or even switching skinned meshes in runtime?

It depends on what you mean by efficient. From a programmer workflow perspective, the most efficient time-wise is probably to create a single model with all body parts as separate meshes rigged to the skeleton. Activate only the meshes you need, and deactivate the others. Since the animation works on the skeleton, it works for all of the meshes rigged to that skeleton.

Thank you for the response. The issue is that these parts may change in the future. Or may be skinned differently over time. Same skeleton, but new parts may be created. And currently there are over 500 parts possible. Would this still be the best method?

Hard to say. Highly-customizable characters like in World of Warcraft use this technique, at least as of a few years ago; I haven’t checked in a while. There are WoW model viewers floating around where you can see what they’re made of. But they also reduce the number parts by reusing the same parts with different textures to make it more practical. And rigid items like swords aren’t part of the model; they’re childed to the hand at runtime.

If you wanted to put more effort into the programming side, you could probably transfer rigging at runtime.

I think it really depends on two factors: (1) workflow, or the amount of effort for the artist and the programmer, and (2) runtime efficiency, which can be affected by memory consumption and computational load.

I see thank you. How would you do that in runtime though? I have something that works that way right now, but it seems very inefficient.

If they’re mapped and weighted equivalently, you should be able to assign the character’s SkinnedMeshRenderer.bones to the body part’s bones.