Esempio n. 1
0
        public static void AddSkeletonBoneLines(Transform root, string prefix, Color color, int render_queue_plus, float parent_width, float child_width)
        {
            Material line_material = GetBoneLineMaterial(color, render_queue_plus);

            if (line_material)
            {
                int counter = NSH.AddBonesComponentsTransform <BoneLine>(root, prefix, delegate_add_bone_line_transform, line_material, parent_width, child_width);
                NeuronTransformsInstance instance = root.GetComponent <NeuronTransformsInstance>();
                instance.Bind(root, prefix);
                Transform t = instance.transforms[(int)NeuronBones.Head];
                if (t != null && t.childCount > 0)
                {
                    // get end_end
                    Transform child = t.GetChild(0);
                    if (child != null)
                    {
                        BoneLine boneline = child.gameObject.AddComponent <BoneLine>();
                        boneline.AddRenderer(line_material, parent_width, child_width, t, child);
                        counter++;
                    }
                }

                Debug.Log(string.Format("[NeuronUtilities] {0} Bone lines added to {1}.", counter, root.name), root);
            }
        }
Esempio n. 2
0
        public static void AddSkeletonBoneLines(Animator animator, Color color, int render_queue_plus, float parent_width, float child_width)
        {
            Material line_material = GetBoneLineMaterial(color, render_queue_plus);

            if (line_material)
            {
                int counter = NSH.AddBonesComponents <BoneLine>(animator, delegate_add_bone_line, line_material, parent_width, child_width);
                Debug.Log(string.Format("[NeuronUtilities] {0} Bone lines added to {1}.", counter, animator.gameObject.name), animator.gameObject);
            }
        }
Esempio n. 3
0
        public static void AddSkeletonBoneLines(Transform root, string prefix, Color color, int render_queue_plus, float parent_width, float child_width)
        {
            Material line_material = GetBoneLineMaterial(color, render_queue_plus);

            if (line_material)
            {
                int counter = NSH.AddBonesComponentsTransform <BoneLine>(root, prefix, delegate_add_bone_line_transform, line_material, parent_width, child_width);
                Debug.Log(string.Format("[NeuronUtilities] {0} Bone lines added to {1}.", counter, root.name), root);
            }
        }
Esempio n. 4
0
        public static void AddSkeletonBoneLines(Animator animator, Color color, int render_queue_plus, float parent_width, float child_width)
        {
            Material line_material = GetBoneLineMaterial(color, render_queue_plus);

            if (line_material)
            {
                int counter = NSH.AddBonesComponents <BoneLine>(animator, delegate_add_bone_line, line_material, parent_width, child_width);

                // add bone line for spine1 and spine2 which we do not assign to animator
                Transform t     = animator.GetBoneTransform(HumanBodyBones.Chest);
                Transform child = t;
                t = t.parent;
                while (t != null && t.GetComponent <BoneLine>() == null)
                {
                    BoneLine bone_line = t.gameObject.AddComponent <BoneLine>();
                    child = t;
                    t     = t.parent;
                    bone_line.AddRenderer(line_material, parent_width, child_width, t, child);

                    counter++;
                }

                // add bone line for head_end
                t = animator.GetBoneTransform(HumanBodyBones.Head);
                if (t != null && t.childCount > 0)
                {
                    // get end_end
                    child = t.GetChild(0);
                    if (child != null)
                    {
                        BoneLine boneline = child.gameObject.AddComponent <BoneLine>();
                        boneline.AddRenderer(line_material, parent_width, child_width, t, child);
                        counter++;
                    }
                }

                Debug.Log(string.Format("[NeuronUtilities] {0} Bone lines added to {1}.", counter, animator.gameObject.name), animator.gameObject);
            }
        }
Esempio n. 5
0
        // remove rigidbodies by transforms
        public static void RemoveSkeletonRigidBodies(Transform root, string prefix)
        {
            int counter = NSH.RemoveBonesComponentsTransform <Rigidbody>(root, prefix, null);

            Debug.Log(string.Format("[NeuronUtilities] {0} Rigidbodies removed from {1}.", counter, root.name), root);
        }
Esempio n. 6
0
        // remove rigidbodies by animator
        public static void RemoveSkeletonRigidBodies(Animator animator)
        {
            int counter = NSH.RemoveBonesComponents <Rigidbody>(animator, null);

            Debug.Log(string.Format("[NeuronUtilities] {0} Rigidbodies removed from {1}.", counter, animator.gameObject.name), animator.gameObject);
        }
Esempio n. 7
0
        public static void AddSkeletonRigidBodies(Transform root, string prefix)
        {
            int counter = NSH.AddBonesComponentsTransform <Rigidbody>(root, prefix, delegate_add_rigidbody_transform);

            Debug.Log(string.Format("[NeuronUtilities] {0} Rigidbodies added to {1}.", counter, root.name), root);
        }
Esempio n. 8
0
        public static void AddSkeletonRigidBodies(Animator animator)
        {
            int counter = NSH.AddBonesComponents <Rigidbody>(animator, delegate_add_rigidbody);

            Debug.Log(string.Format("[NeuronUtilities] {0} Rigidbodies added to {1}.", counter, animator.gameObject.name), animator.gameObject);
        }
Esempio n. 9
0
        public static void RemoveSkeletonBoneLines(Transform root, string prefix)
        {
            int counter = NSH.RemoveBonesComponentsTransform <BoneLine>(root, prefix, delegate_remove_bone_line_tranform);

            Debug.Log(string.Format("[NeuronUtilities] {0} Bone lines removed from {1}.", counter, root.name), root);
        }
Esempio n. 10
0
        public static void RemoveSkeletonBoneLines(Animator animator)
        {
            int counter = NSH.RemoveBonesComponents <BoneLine>(animator, delegate_remove_bone_line);

            Debug.Log(string.Format("[NeuronUtilities] {0} Bone lines removed from {1}.", counter, animator.gameObject.name), animator.gameObject);
        }