Quantcast
Channel: Answers for "Assigning a clothing object to a character's skeleton?"
Viewing all articles
Browse latest Browse all 9

Answer by Disrar

$
0
0
I've created a temporary workaround for parenting a clothing's skeleton to the character's, however it isn't ideal as I haven't figured out a way to find bones automatically. I set up a script that contains Transform variables for each bone on the character, using UnityEngine; using System.Collections; public class CharacterBoneList : MonoBehaviour { public Transform Hips; public Transform Spine; public Transform Chest; . . . etc for each bone } then call ParentClothBoneToChar () from a script attached to the clothing item that has variables for each bone as well: using UnityEngine; using System.Collections; public class ParentClothBoneToChar : MonoBehaviour { public Transform clothHips; public Transform clothSpine; public Transform clothChest; ...etc public CharacterBoneList charBones; public void ParentBonesToChar () { charBones=GameObject.Find("Player").GetComponent(); clothHips.SetParent (charBones.Hips); clothSpine.SetParent (charBones.Spine); clothChest.SetParent (charBones.Chest); . . . etc, for each bone. } } Of course this means having 4+ skeletons on each character since you need one for each article of clothing. I know that bones in Unity are simply GameObjects, but having over 4x than what is needed seems a bit inefficient to me.

Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>