static void AddBoneLine( HumanBodyBones bone, BoneLine bone_line, params object[] args )
		{
			if( args.Length < 3 || bone == HumanBodyBones.Hips )
			{
				return;
			}
			
			Material mat = (Material)args[0];
			float parent_width = (float)args[1];
			float child_width = (float)args[2];
			
			if( bone >= HumanBodyBones.LeftThumbProximal && bone <= HumanBodyBones.RightLittleDistal )
			{
				bone_line.AddRenderer( mat, parent_width / 3.0f, child_width / 3.0f, bone_line.transform.parent, bone_line.transform );
			}
			else
			{
				bone_line.AddRenderer( mat, parent_width, child_width, bone_line.transform.parent, bone_line.transform );
			}
		}
Exemple #2
0
        static void AddBoneLineTransform(NeuronBones bone, BoneLine bone_line, params object[] args)
        {
            if (args.Length < 3 || bone == NeuronBones.Hips)
            {
                return;
            }

            Material mat          = (Material)args[0];
            float    parent_width = (float)args[1];
            float    child_width  = (float)args[2];

            if (bone >= NeuronBones.LeftHandThumb1 && bone <= NeuronBones.LeftHandPinky3 ||
                bone >= NeuronBones.RightHandThumb1 && bone <= NeuronBones.RightHandPinky3)
            {
                bone_line.AddRenderer(mat, parent_width / 3.0f, child_width / 3.0f, bone_line.transform.parent, bone_line.transform);
            }
            else
            {
                bone_line.AddRenderer(mat, parent_width, child_width, bone_line.transform.parent, bone_line.transform);
            }
        }
Exemple #3
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);
            }
        }
		static void AddBoneLineTransform( NeuronBones bone, BoneLine bone_line, params object[] args )
		{
			if( args.Length < 3 || bone == NeuronBones.Hips )
			{
				return;
			}
			
			Material mat = (Material)args[0];
			float parent_width = (float)args[1];
			float child_width = (float)args[2];
			
			if( bone >= NeuronBones.LeftHandThumb1 && bone <= NeuronBones.LeftHandPinky3
			   ||  bone >= NeuronBones.RightHandThumb1 && bone <= NeuronBones.RightHandPinky3 )
			{
				bone_line.AddRenderer( mat, parent_width / 3.0f, child_width / 3.0f, bone_line.transform.parent, bone_line.transform );
			}
			else
			{
				bone_line.AddRenderer( mat, parent_width, child_width, bone_line.transform.parent, bone_line.transform );
			}
		}