Exemplo n.º 1
0
        private void DestroyHierarchy(TransformCache root)
        {
            Debug.Assert(root != null);

            var children = root.children;

            foreach (var child in children)
            {
                DestroyHierarchy(child);
            }

            skinningCache.Destroy(root);
        }
Exemplo n.º 2
0
        new public void SetParent(TransformCache newParent, bool worldPositionStays)
        {
            if (parentBone != null && parentBone.chainedChild == this)
            {
                parentBone.chainedChild = null;
            }

            base.SetParent(newParent, worldPositionStays);

            if (parentBone != null && parentBone.chainedChild == null && (parentBone.endPosition - position).sqrMagnitude < 0.001f)
            {
                parentBone.chainedChild = this;
            }
        }
Exemplo n.º 3
0
        void SetBonePositionAndRotation(BoneCache[] boneCache, TransformCache bone, Vector3[] position, Quaternion[] rotation)
        {
            var index = Array.FindIndex(boneCache, x => x == bone);

            if (index >= 0)
            {
                bone.position = position[index];
                bone.rotation = rotation[index];
            }
            foreach (var child in bone.children)
            {
                SetBonePositionAndRotation(boneCache, child, position, rotation);
            }
        }
Exemplo n.º 4
0
        public void SetBoneParent(BoneCache newParent, BoneCache bone, int insertAtIndex)
        {
            TransformCache parent = newParent;

            if (newParent == null)
            {
                parent = bone.skeleton;
            }

            skinningCache.RestoreBindPose();
            bone.SetParent(parent, true);

            if (insertAtIndex == -1)
            {
                insertAtIndex = parent.ChildCount;
            }

            bone.siblingIndex = insertAtIndex;
            bone.SetDefaultPose();
        }
Exemplo n.º 5
0
 new public void SetParent(TransformCache newParent)
 {
     SetParent(newParent, true);
 }