Question by
SmileTR · Feb 16, 2016 at 01:15 PM ·
blendshapesclothingmorphcharacter customization
Help Character Customization [Clothing Morph/BlendShape Problem]
Hi guys,
This problem, such ;
Gif | Last Picture - 4 | Last Picture - 5
Does the solution for this problem? (like vertices) Or another way? How to combine clothes with the body? I'm waiting for your help. Thank you.
using UnityEngine;
using System.Collections;
public class Dress_System : MonoBehaviour {
public GameObject objPlayer;
public GameObject objLimb;
void Update ()
{
if (Input.GetKeyDown(KeyCode.Space))
{
Debug.Log("Clicked");
AddLimb(objLimb, objPlayer);
}
}
void AddLimb(GameObject BonedObj, GameObject RootObj)
{
var BonedObjects = BonedObj.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
foreach (SkinnedMeshRenderer SkinnedRenderer in BonedObjects)
ProcessBonedObject(SkinnedRenderer, RootObj);
}
private void ProcessBonedObject(SkinnedMeshRenderer ThisRenderer, GameObject RootObj)
{
var NewObj = new GameObject(ThisRenderer.gameObject.name);
NewObj.transform.parent = RootObj.transform;
NewObj.AddComponent<SkinnedMeshRenderer>();
var NewRenderer = NewObj.GetComponent<SkinnedMeshRenderer>();
var MyBones = new Transform[ThisRenderer.bones.Length];
for (var i = 0; i < ThisRenderer.bones.Length; i++)
MyBones[i] = FindChildByName(ThisRenderer.bones[i].name, RootObj.transform);
NewRenderer.bones = MyBones;
NewRenderer.sharedMesh = ThisRenderer.sharedMesh;
NewRenderer.materials = ThisRenderer.materials;
}
private Transform FindChildByName(string ThisName, Transform ThisGObj)
{
Transform ReturnObj;
if (ThisGObj.name == ThisName)
return ThisGObj.transform;
foreach (Transform child in ThisGObj)
{
ReturnObj = FindChildByName(ThisName, child);
if (ReturnObj)
return ReturnObj;
}
return null;
}
}
Comment
I also would like to know. I've searched everywhere and it doesn't seem like it's possible in unity
Your answer
Follow this Question
Related Questions
I want to ask how to mix my character face morpher with my character body animate 0 Answers
Blend shape Animations looks diffrent in preview 1 Answer
Character dies on startup. 0 Answers
change skinnedmeshrenderer bone, but the blendshape animation invalid 0 Answers
BlendShape results are different for the same model 1 Answer