Search Unity

Clothes dont follow rigg

Discussion in 'Animation' started by designerz, Jun 16, 2019.

  1. designerz

    designerz

    Joined:
    Jan 10, 2013
    Posts:
    3
    Sorry for my bad english, i m french.
    i have a problem with clothes . ( i m on Unity 2018.3.6f1)

    I have buy an avatar.
    I created clothes for this avatar.
    everything is set in humanoid rig.
    If I import the avatar change with the clothes, it works well.
    If i import the clothes alone, it's dont follow the bones avatar and remains in Tpose.

    I had this problem with the avatar of Daz / Genesis. a script allowed to correct this but this script does not work on this new avatar. could someone please help me?

    Sure, i can pay for help to fix that .
    thank you.

    The Daz Script
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using System.Linq;
    5.  
    6. public class Copy_Bones : MonoBehaviour {
    7.  
    8.     public GameObject SourceObject;
    9.  
    10.     // Use this for initialization
    11.  
    12.     void Start () {
    13.         Copy();
    14.     }
    15.  
    16.  
    17.     void Copy()
    18.     {
    19.         if (SourceObject == null) return;
    20.  
    21.         var sourceRenderer = SourceObject.GetComponent<SkinnedMeshRenderer>();
    22.         var targetRenderer = GetComponent<SkinnedMeshRenderer> ();
    23.  
    24.         if (sourceRenderer == null) return;
    25.         if (targetRenderer == null) return;
    26.  
    27.         targetRenderer.bones =
    28.             sourceRenderer.bones.Where(b => targetRenderer.bones.Any (t => t.name == b.name)).ToArray ();
    29.     }
    30. }
    31.  
     
    Last edited: Jun 16, 2019