So after the body ready, what should we do? My plan was to make the body unique with each other, therefore I made several models for the head. The models for the head were Viking head, knight head, and roman head. Also, there were 3 different colours for the skin of the bodies.



After finish built the models on blender, I wrote some scripts to randomize the style and skin colour for the ragdoll. To perform this, I need to change the MeshRenderer through the script. Using rand syntax to get random value from 1 to 3, then using switch case syntax to choose which model needs to be generated.
Code to change meshRenderer
List<Material> myList = new List<Material>();
myList.Add(Resources.Load(“Prefabs/Blender/” + helmet + “/Materials/Fur” + randFur, typeof(Material)) as Material);
myList.Add(Resources.Load(“Prefabs/Blender/” + helmet + “/Materials/Hat” + randHatRoman, typeof(Material)) as Material);
myList.Add(Resources.Load(“Prefabs/Blender/” + helmet + “/Materials/Head” + randHead, typeof(Material)) as Material);
Then the result will look like this
Be First to Comment