Example #1
0
        /// <summary>
        /// Adds the transform into the skeleton.
        /// </summary>
        /// <param name="transform">Transform.</param>
        public virtual void AddBone(UMATransform transform)
        {
            var      go      = new GameObject(transform.name);
            BoneData newBone = new BoneData()
            {
                accessedFrame      = -1,
                parentBoneNameHash = transform.parent,
                boneNameHash       = transform.hash,
                boneTransform      = go.transform,
                umaTransform       = transform.Duplicate(),
            };

            if (!boneHashData.ContainsKey(transform.hash))
            {
                boneHashData.Add(transform.hash, newBone);
#if UNITY_EDITOR
                boneHashDataBackup.Add(newBone);
#endif
            }
            else
            {
                if (Debug.isDebugBuild)
                {
                    Debug.LogError("AddBone: " + transform.name + " already exists in the dictionary! Consider renaming those bones. For example, `Items` under each hand bone can become `LeftItems` and `RightItems`.");
                }
            }
        }
Example #2
0
        /// <summary>
        /// Adds the transform into the skeleton.
        /// </summary>
        /// <param name="transform">Transform.</param>
        public virtual void AddBone(UMATransform transform)
        {
            var      go      = new GameObject(transform.name);
            BoneData newBone = new BoneData()
            {
                accessedFrame      = -1,
                parentBoneNameHash = transform.parent,
                boneNameHash       = transform.hash,
                boneTransform      = go.transform,
                umaTransform       = transform.Duplicate(),
            };

            boneHashDataBackup.Add(newBone);
            boneHashData.Add(transform.hash, newBone);
        }
Example #3
0
        /// <summary>
        /// Adds the transform into the skeleton.
        /// </summary>
        /// <param name="transform">Transform.</param>
        public virtual void AddBone(UMATransform transform)
        {
            var      go      = new GameObject(transform.name);
            BoneData newBone = new BoneData()
            {
                accessedFrame      = -1,
                parentBoneNameHash = transform.parent,
                boneNameHash       = transform.hash,
                boneTransform      = go.transform,
                umaTransform       = transform.Duplicate(),
            };

            if (!boneHashData.ContainsKey(transform.hash))
            {
                boneHashData.Add(transform.hash, newBone);
#if UNITY_EDITOR
                boneHashDataBackup.Add(newBone);
#endif
            }
            else
            {
                Debug.LogError("AddBone: " + transform.name + " already exists in the dictionary!");
            }
        }