Why isn't my Script to Conforming/Attaching DAZ Clothng at runtime working?
Hello guys good evening thanks for all the help as always,
I'm making my preparations for my a game and one of them is learning how to attatch/conform/fit cltohes in Unity because by defautl clothes do not work well in animations, the body poke though and legs pop out of the lcothing like skirts and pants and ddresses. But i discovered a tutorial where through a script, they make the c lothes bend with the body and kind of work the way Conforming clothes would in Daz studio. IN the tutorial i saw, which was made in like 2014 or 2015 it worked rpretty well and it was great, but its the first time i'm trtying it out...but guess what? Yesterday i kind of searcht the web for a more modern tutorial of doing the same thing and I found!!! i found another script posted by a Unity 2taff that does the same thing. And so i gave it a try and unfortunately it didn't work. And it might be total my fault because i'm known to be not too bright so i dont' know if it's my fault or if the script jsut doesn't work in Unity 20201.1.5(version i use now).
Can anyone check this script and tell me why it wouldn't work and if i'm doing something wrong. Basically i'm adding ito the cloth item like the pants, i've trieed adding ito the top most parent of the clothes, then to the object below that, and then tried even to the .Shape objetct of the cloth and it didn't work, for the target source i inputted the G8male.Shape . here's the script
using System.Collections.Generic; using UnityEngine; public class Equipmentizer : MonoBehaviour { public SkinnedMeshRenderer TargetMeshRenderer; void Start() { Dictionary<string, Transform> boneMap = new Dictionary<string, Transform>(); foreach (Transform bone in TargetMeshRenderer.bones) boneMap[bone.gameObject.name] = bone; SkinnedMeshRenderer myRenderer = gameObject.GetComponent<SkinnedMeshRenderer>(); Transform[] newBones = new Transform[myRenderer.bones.Length]; for (int i = 0; i < myRenderer.bones.Length; ++i) { GameObject bone = myRenderer.bones[i].gameObject; if (!boneMap.TryGetValue(bone.name, out newBones[i])) { Debug.Log("Unable to map bone \"" + bone.name + "\" to target skeleton."); break; } } myRenderer.bones = newBones; } }