void UpdateBlend(Transform curBlend)
    {
        BlendConstraint constraint = curBlend.GetComponent <BlendConstraint>();

        constraint.data.positionWeight = globalBlend;
        constraint.data.rotationWeight = globalBlend;
        for (int i = 0; i < curBlend.childCount; i++)
        {
            UpdateBlend(curBlend.GetChild(i));
        }
    }
예제 #2
0
    void BlendRigBone(Transform currentReference, Transform A, Transform B, Transform current) {
        for (int i = 0; i < currentReference.transform.childCount; i++) {
            Transform curBone = currentReference.transform.GetChild(i);
            Transform curA = A.transform.GetChild(i);
            Transform curB = B.transform.GetChild(i);
            GameObject newBlend = new GameObject("blend:" + curBone.name);
            newBlend.transform.parent = current;

            BlendConstraint newConstraint = newBlend.AddComponent<BlendConstraint>();
            newConstraint.data.constrainedObject = curBone;
            newConstraint.data.sourceObjectA = curA;
            newConstraint.data.sourceObjectB = curB;

            BlendRigBone(curBone, curA, curB,newBlend.transform);
        }
    }