RPG bones and clothes

Hi to all, this is my first post :slight_smile:

What is the best practice to build characters that are customizable (can change armor, gauntlets, helm ecc…) at runtime?

My problem:

I use 3d max 2012, and if i import a skeleton (a simple skeleton homemade… no skins, nothing at all, a simple skeleton made of bones. nothing attached or linked to it), and the at the runtime i tell:

hand.transform.position = boneofthehand.transform.position;
hand.transform.rotation = boneofthehand.transform.rotation;
hand.transform.parent = boneofthehand.transform;

the hand has a bad position and rotation (i controlled in 3d max that the hand and the bone of the hand have the EXACT same lenght, Pivot point in the same exact point and direction…).

but if i simply put the hand over the bone in 3dmax… and i link it to the bone… and i import the model already made into unity woks great.

WHY??

what is the best practice to follow, when you have an RPG like character, that will change weapons and clothes in the runtime?

i tought to create simple skeletons… without nothing on them, import them, and then attach the “pieces” (hands, foot, legs), of the chosen type at runtime… but it seems works really bad.

thanks

There’s a couple different ways, but the one I see the most often, and the one that I typically use, is to create the skeleton and weight all the possible meshes (character, gloves, pants, etc) to that one skeleton and import it into Unity. Then just hide all the clothing meshes except for the ones he is currently wearing.

what command you use, to hide the object you don’t need? … but the object are still used and consumes cpu?

Just disable the mesh renderer or disable the whole mesh object in Unity. Unchecking the box in the editor will do it initially, via code you can do it by setting the enabled or active property to false (don’t remember off hand which).

When it’s disabled, it won’t be rendered and I don’t think that the animation system bothers manipulating it, so it shouldn’t cause any increase in CPU or GPU usage. I’ve used this method in several projects and haven’t had any problems with it.

Ok, then if i have understood well, i simply create the skeleton, then i create all possible models that will use that skeleton… i link each piece to each of the bone… for each model…and i put the model in the right position in the authoring tool (will be a lot of models in the same position, right?), then i import this “abomination” in unity… and then via script i disable the mesh renderer of each one?

so will remain only 1 active… the actual piece used?

but… the mesh filter… will not do the calculations for EACH piece? i cannot disable the mesh filter…

well i though of using empty gameobject on the Character model.
And thise empty gameobject indicate where armor, weapons and stuff located. And just parrent the model to the empty gameobject.
I dont know if that a good practic but just something i came up and wanted to use when i get to that.

Parenting in unity without weight painting works fine for rigid, unbending types of clothing. A hat or steel helmet would work fine since it doesn’t bend. A leather jerkin or chainmail doesn’t work so well since it should flex with the body. You can use both methods, have all the flexible clothing as part of the model and parent the separate rigid clothing meshes to a bone.