Ejemplo n.º 1
0
    public Transform EditorFindOrCreateMountpoint()
    {
        Transform BoneTransform = SkeletonTools.RecursiveFindBone(avatar.gameObject.transform, BoneName);

        if (BoneTransform == null)
        {
            return(null);
        }
        foreach (Transform child in BoneTransform)
        {
            if (child.name == ID)
            {
                return(child);
            }
        }
        return(CreateMountpoint(BoneTransform, avatar.gameObject.layer));
    }
Ejemplo n.º 2
0
    public void AddJiggle(UMAData umaData)
    {
        UMABoneCleaner cleaner  = umaData.gameObject.GetComponent <UMABoneCleaner>();
        Transform      rootBone = SkeletonTools.RecursiveFindBone(umaData.umaRoot.transform, jiggleBoneName);

        AddBoneJiggle(umaData, rootBone, cleaner);
        if (AdditionalBones != null)
        {
            foreach (string s in AdditionalBones)
            {
                if (!string.IsNullOrEmpty(s))
                {
                    rootBone = SkeletonTools.RecursiveFindBone(umaData.umaRoot.transform, s);
                    AddBoneJiggle(umaData, rootBone, cleaner);
                }
            }
        }
    }
    public void AddJiggle(UMAData umaData)
    {
        Transform        rootBone      = SkeletonTools.RecursiveFindBone(umaData.umaRoot.transform, jiggleBoneName);
        UMABoneCleaner   cleaner       = umaData.gameObject.GetComponent <UMABoneCleaner>();
        List <Transform> exclusionList = new List <Transform>();

        if (rootBone != null)
        {
#if DYNAMIC_BONE
            DynamicBone jiggleBone = rootBone.GetComponent <DynamicBone>();
            if (jiggleBone == null)
            {
                jiggleBone = rootBone.gameObject.AddComponent <DynamicBone>();
            }

            jiggleBone.m_Root = rootBone;



            foreach (string exception in exceptions)
            {
                exclusionList.Add(umaData.gameObject.transform.FindDeepChild(exception));
            }

            jiggleBone.m_Exclusions = exclusionList;
            jiggleBone.m_Inert      = reduceEffect;
            jiggleBone.UpdateParameters();
#else
            SwayRootBone jiggleBone = rootBone.GetComponent <SwayRootBone>();
            if (jiggleBone == null)
            {
                jiggleBone = rootBone.gameObject.AddComponent <SwayRootBone>();
            }

            foreach (string exception in exceptions)
            {
                exclusionList.Add(SkeletonTools.RecursiveFindBone(umaData.gameObject.transform, exception));
            }

            jiggleBone.Exclusions = exclusionList;
            jiggleBone.inertia    = reduceEffect;
            jiggleBone.SetupBoneChains();
#endif
        }

        if (deleteBoneWithSlot)
        {
            if (cleaner == null)
            {
                cleaner = umaData.gameObject.AddComponent <UMABoneCleaner>();
            }

            UMAJiggleBoneListing listing = new UMAJiggleBoneListing();
            listing.boneName    = jiggleBoneName;
            listing.carrierSlot = slotToWatch;

            linkedRecipe = umaData.gameObject.GetComponent <DynamicCharacterAvatar>().GetWardrobeItemName(slotToWatch);

            listing.recipe = linkedRecipe;

            listing.exceptions = exclusionList;
            cleaner.RegisterJiggleBone(listing);
        }
    }