Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     mf1        = GetComponent <SkinnedMeshRenderer>();
     vertices   = mf1.sharedMesh.vertices;
     body       = transform;
     crumb      = crumb2;
     sphereFab2 = sphereFab;
     Skinned();
     addCoords();
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     mf1      = GetComponent <SkinnedMeshRenderer>();
     vertices = mf1.sharedMesh.vertices;
     print(mf1.sharedMesh.vertexCount);
     body       = transform;
     crumb      = crumb2;
     sphereFab2 = sphereFab;
     Skinned();
 }
Ejemplo n.º 3
0
    public static void Skinned()
    {
        var matrix = body.localToWorldMatrix;

        //Jawline
        v1                   = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5501]), body.rotation) as IndexedSphere);
        v1.vIndex            = 5501;
        v1.vertexLoc         = matrix.MultiplyPoint3x4(vertices[v1.vIndex]);
        v1.transform.parent  = body;
        v2                   = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5505]), body.rotation) as IndexedSphere);
        v2.vIndex            = 5505;
        v2.vertexLoc         = matrix.MultiplyPoint3x4(vertices[v2.vIndex]);
        v2.transform.parent  = body;
        v3                   = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5723]), body.rotation) as IndexedSphere);
        v3.vIndex            = 5723;
        v3.vertexLoc         = matrix.MultiplyPoint3x4(vertices[v3.vIndex]);
        v3.transform.parent  = body;
        v4                   = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5351]), body.rotation) as IndexedSphere);
        v4.vIndex            = 5351;
        v4.vertexLoc         = matrix.MultiplyPoint3x4(vertices[v4.vIndex]);
        v4.transform.parent  = body;
        v5                   = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4905]), body.rotation) as IndexedSphere);
        v5.vIndex            = 4905;
        v5.vertexLoc         = matrix.MultiplyPoint3x4(vertices[v5.vIndex]);
        v5.transform.parent  = body;
        v6                   = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4553]), body.rotation) as IndexedSphere);
        v6.vIndex            = 4553;
        v6.vertexLoc         = matrix.MultiplyPoint3x4(vertices[v6.vIndex]);
        v6.transform.parent  = body;
        v7                   = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4551]), body.rotation) as IndexedSphere);
        v7.vIndex            = 4551;
        v7.vertexLoc         = matrix.MultiplyPoint3x4(vertices[v7.vIndex]);
        v7.transform.parent  = body;
        v8                   = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4543]), body.rotation) as IndexedSphere);
        v8.vIndex            = 4543;
        v8.vertexLoc         = matrix.MultiplyPoint3x4(vertices[v8.vIndex]);
        v8.transform.parent  = body;
        v9                   = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3168]), body.rotation) as IndexedSphere);
        v9.vIndex            = 3168;
        v9.vertexLoc         = matrix.MultiplyPoint3x4(vertices[v9.vIndex]);
        v9.transform.parent  = body;
        v10                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4096]), body.rotation) as IndexedSphere);
        v10.vIndex           = 4096;
        v10.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v10.vIndex]);
        v10.transform.parent = body;
        v11                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3291]), body.rotation) as IndexedSphere);
        v11.vIndex           = 3291;
        v11.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v11.vIndex]);
        v11.transform.parent = body;
        v12                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3570]), body.rotation) as IndexedSphere);
        v12.vIndex           = 3570;
        v12.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v12.vIndex]);
        v12.transform.parent = body;
        v13                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3700]), body.rotation) as IndexedSphere);
        v13.vIndex           = 3700;
        v13.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v13.vIndex]);
        v13.transform.parent = body;
        v14                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3971]), body.rotation) as IndexedSphere);
        v14.vIndex           = 3971;
        v14.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v14.vIndex]);
        v14.transform.parent = body;
        v15                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5739]), body.rotation) as IndexedSphere);
        v15.vIndex           = 5739;
        v15.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v15.vIndex]);
        v15.transform.parent = body;
        v16                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4101]), body.rotation) as IndexedSphere);
        v16.vIndex           = 4101;
        v16.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v16.vIndex]);
        v16.transform.parent = body;
        v17                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4123]), body.rotation) as IndexedSphere);
        v17.vIndex           = 4123;
        v17.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v17.vIndex]);
        v17.transform.parent = body;

        //Left Eyebrow
        v18                  = (Instantiate(sphereFab2, body.TransformPoint(vertices[4668]), body.rotation) as IndexedSphere);
        v18.vIndex           = 4668;
        v18.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v18.vIndex]);
        v18.transform.parent = body;
        v19                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4774]), body.rotation) as IndexedSphere);
        v19.vIndex           = 4774;
        v19.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v19.vIndex]);
        v19.transform.parent = body;
        v20                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4869]), body.rotation) as IndexedSphere);
        v20.vIndex           = 4869;
        v20.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v20.vIndex]);
        v20.transform.parent = body;
        v21                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4962]), body.rotation) as IndexedSphere);
        v21.vIndex           = 4962;
        v21.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v21.vIndex]);
        v21.transform.parent = body;
        v22                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[6212]), body.rotation) as IndexedSphere);
        v22.vIndex           = 6212;
        v22.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v22.vIndex]);
        v22.transform.parent = body;

        //Right Eyebrow
        v23                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[6146]), body.rotation) as IndexedSphere);
        v23.vIndex           = 6146;
        v23.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v23.vIndex]);
        v23.transform.parent = body;
        v24                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4111]), body.rotation) as IndexedSphere);
        v24.vIndex           = 4111;
        v24.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v24.vIndex]);
        v24.transform.parent = body;
        v25                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3380]), body.rotation) as IndexedSphere);
        v25.vIndex           = 3380;
        v25.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v25.vIndex]);
        v25.transform.parent = body;
        v26                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3544]), body.rotation) as IndexedSphere);
        v26.vIndex           = 3544;
        v26.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v26.vIndex]);
        v26.transform.parent = body;
        v27                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3379]), body.rotation) as IndexedSphere);
        v27.vIndex           = 3379;
        v27.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v27.vIndex]);
        v27.transform.parent = body;

        //Nose Bridge
        v28                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4053]), body.rotation) as IndexedSphere);
        v28.vIndex           = 4053;
        v28.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v28.vIndex]);
        v28.transform.parent = body;
        v29                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4162]), body.rotation) as IndexedSphere);
        v29.vIndex           = 4162;
        v29.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v29.vIndex]);
        v29.transform.parent = body;
        v30                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3180]), body.rotation) as IndexedSphere);
        v30.vIndex           = 3180;
        v30.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v30.vIndex]);
        v30.transform.parent = body;
        v31                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5958]), body.rotation) as IndexedSphere);
        v31.vIndex           = 5958;
        v31.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v31.vIndex]);
        v31.transform.parent = body;

        //Nose
        v32                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5988]), body.rotation) as IndexedSphere);
        v32.vIndex           = 5988;
        v32.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v32.vIndex]);
        v32.transform.parent = body;
        v33                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4742]), body.rotation) as IndexedSphere);
        v33.vIndex           = 4742;
        v33.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v33.vIndex]);
        v33.transform.parent = body;
        v34                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3176]), body.rotation) as IndexedSphere);
        v34.vIndex           = 3176;
        v34.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v34.vIndex]);
        v34.transform.parent = body;
        v35                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3353]), body.rotation) as IndexedSphere);
        v35.vIndex           = 3353;
        v35.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v35.vIndex]);
        v35.transform.parent = body;
        v36                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5986]), body.rotation) as IndexedSphere);
        v36.vIndex           = 5986;
        v36.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v36.vIndex]);
        v36.transform.parent = body;

        //Left Eye
        v37                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4824]), body.rotation) as IndexedSphere);
        v37.vIndex           = 4824;
        v37.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v37.vIndex]);
        v37.transform.parent = body;
        v38                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[6035]), body.rotation) as IndexedSphere);
        v38.vIndex           = 6035;
        v38.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v38.vIndex]);
        v38.transform.parent = body;
        v39                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4830]), body.rotation) as IndexedSphere);
        v39.vIndex           = 4830;
        v39.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v39.vIndex]);
        v39.transform.parent = body;
        v40                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4930]), body.rotation) as IndexedSphere);
        v40.vIndex           = 4930;
        v40.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v40.vIndex]);
        v40.transform.parent = body;
        v41                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5314]), body.rotation) as IndexedSphere);
        v41.vIndex           = 5314;
        v41.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v41.vIndex]);
        v41.transform.parent = body;
        v42                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[7081]), body.rotation) as IndexedSphere);
        v42.vIndex           = 7081;
        v42.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v42.vIndex]);
        v42.transform.parent = body;

        //Right Eye
        v43                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[6276]), body.rotation) as IndexedSphere);
        v43.vIndex           = 6276;
        v43.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v43.vIndex]);
        v43.transform.parent = body;
        v44                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4132]), body.rotation) as IndexedSphere);
        v44.vIndex           = 4132;
        v44.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v44.vIndex]);
        v44.transform.parent = body;
        v45                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4134]), body.rotation) as IndexedSphere);
        v45.vIndex           = 4134;
        v45.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v45.vIndex]);
        v45.transform.parent = body;
        v46                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3500]), body.rotation) as IndexedSphere);
        v46.vIndex           = 3500;
        v46.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v46.vIndex]);
        v46.transform.parent = body;
        v47                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3496]), body.rotation) as IndexedSphere);
        v47.vIndex           = 3496;
        v47.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v47.vIndex]);
        v47.transform.parent = body;
        v48                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3911]), body.rotation) as IndexedSphere);
        v48.vIndex           = 3911;
        v48.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v48.vIndex]);
        v48.transform.parent = body;

        //Mouth Outline
        v49                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5319]), body.rotation) as IndexedSphere);
        v49.vIndex           = 5319;
        v49.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v49.vIndex]);
        v49.transform.parent = body;
        v50                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4710]), body.rotation) as IndexedSphere);
        v50.vIndex           = 4710;
        v50.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v50.vIndex]);
        v50.transform.parent = body;
        v51                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[6071]), body.rotation) as IndexedSphere);
        v51.vIndex           = 6071;
        v51.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v51.vIndex]);
        v51.transform.parent = body;
        v52                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3173]), body.rotation) as IndexedSphere);
        v52.vIndex           = 3173;
        v52.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v52.vIndex]);
        v52.transform.parent = body;
        v53                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[6085]), body.rotation) as IndexedSphere);
        v53.vIndex           = 6085;
        v53.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v53.vIndex]);
        v53.transform.parent = body;
        v54                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3323]), body.rotation) as IndexedSphere);
        v54.vIndex           = 3323;
        v54.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v54.vIndex]);
        v54.transform.parent = body;
        v55                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4063]), body.rotation) as IndexedSphere);
        v55.vIndex           = 4063;
        v55.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v55.vIndex]);
        v55.transform.parent = body;
        v56                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3317]), body.rotation) as IndexedSphere);
        v56.vIndex           = 3317;
        v56.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v56.vIndex]);
        v56.transform.parent = body;
        v57                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3409]), body.rotation) as IndexedSphere);
        v57.vIndex           = 3409;
        v57.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v57.vIndex]);
        v57.transform.parent = body;
        v58                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3184]), body.rotation) as IndexedSphere);
        v58.vIndex           = 3184;
        v58.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v58.vIndex]);
        v58.transform.parent = body;
        v59                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4702]), body.rotation) as IndexedSphere);
        v59.vIndex           = 4702;
        v59.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v59.vIndex]);
        v59.transform.parent = body;
        v60                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4704]), body.rotation) as IndexedSphere);
        v60.vIndex           = 4704;
        v60.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v60.vIndex]);
        v60.transform.parent = body;

        //Mouth Inner
        v61                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[5107]), body.rotation) as IndexedSphere);
        v61.vIndex           = 5107;
        v61.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v61.vIndex]);
        v61.transform.parent = body;
        v62                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4589]), body.rotation) as IndexedSphere);
        v62.vIndex           = 4589;
        v62.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v62.vIndex]);
        v62.transform.parent = body;
        v63                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3727]), body.rotation) as IndexedSphere);
        v63.vIndex           = 3727;
        v63.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v63.vIndex]);
        v63.transform.parent = body;
        v64                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3325]), body.rotation) as IndexedSphere);
        v64.vIndex           = 3325;
        v64.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v64.vIndex]);
        v64.transform.parent = body;
        v65                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3722]), body.rotation) as IndexedSphere);
        v65.vIndex           = 3722;
        v65.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v65.vIndex]);
        v65.transform.parent = body;
        v66                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3321]), body.rotation) as IndexedSphere);
        v66.vIndex           = 3321;
        v66.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v66.vIndex]);
        v66.transform.parent = body;
        v67                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[3171]), body.rotation) as IndexedSphere);
        v67.vIndex           = 3171;
        v67.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v67.vIndex]);
        v67.transform.parent = body;
        v68                  = (Instantiate(sphereFab2, matrix.MultiplyPoint3x4(vertices[4577]), body.rotation) as IndexedSphere);
        v68.vIndex           = 4577;
        v68.vertexLoc        = matrix.MultiplyPoint3x4(vertices[v68.vIndex]);
        v68.transform.parent = body;
    }