2
\$\begingroup\$

Imagine a character that can equip different game items like helmets, gloves, shoes, etc. Each different item have its own mesh, bone rig and animations.

What is the best way to create such a system using Unity3d?

\$\endgroup\$
1
  • \$\begingroup\$ It might be beneficial to ask a more specific question. There are a vast number of answers to this, and it's done in professionally developed games in a variety of ways. Typically this will involve a character model and equipment models that are designed for them, often with scaling features built into the models themselves. But this question is far too open ended for SE. \$\endgroup\$ – Jesse Williams Nov 23 '20 at 19:13
1
\$\begingroup\$

You usually approach this by making the item a child of the skeletal node it should remain "fixed" to.

Eg for a rigged human skeleton, you'd make the helmet a child of the neck/head bone, a sword might be attached to the wrist or the pelvis, depending on whether it's drawn or sheathed.

More broadly, you need to implement a system to track which items attach to which bones and parent them as needed to add/remove items.

More complex items (eg a tabard) might require multiple attachment points, or a custom shader depending on what you're trying to achieve.

\$\endgroup\$
0
\$\begingroup\$

Even vaguely professional 3d modeling programs support hierarchical objects, and Unity can import them as hierarchies of gameObjects which can be activated and deactivated separately.

So when the number and the level of detail of your different character options are low enough to allow it, then it can be an option to have all the different customization option in the same character model file in form of different sub-objects. So your character model includes 5 different shirt objects all attached to the same armature, but you only activate one at a time.

This has the advantage that you can very easily try out different customization combinations in your modeling programs. This allows you to see if your animations work well with every combination while you are making them. You don't have to switch between Unity and Blender (or whatever else you prefer) all the time to test if it's all aligned correctly.

One disadvantage of this approach can be performance and memory usage. Both your modeling program and Unity have to load all the customization options at once, including those the player does not use right now. But this might not become an issue unless you go for an AAA level of detail. Another disadvantage is that it makes collaboration harder, because there is just one character model file. When you want to have multiple artists creating different customization items independently, then you really want a solution where each item comes in its own file.

\$\endgroup\$
0
\$\begingroup\$

Disclaimer: this is a very complicated and lengthy process that will require many different skill sets.

This tutorial series from Sebastian Lague will cover this topic from making your models in blender to importing them into unity: https://m.youtube.com/playlist?list=PLFt_AvWsXl0f4c56CbvYi038zmCmoZ4CQ

The basics is that you will have extra objects to represent the clothing of your character. These objects will be weight painted to match the skeleton of the model. They may also contain shape keys that deform the original body mesh to help prevent it from clipping through tight clothing.

I haven't done anything on the unity side, so you will have to watch the videos for how all of that fits into unity.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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