//---------------------------------------------------------------



    private void createSnapObjects()
    {
        List <List <Vector3> > ptSets     = refObj.getAllPtSets();
        List <bool>            setVisible = refObj.getAllVisibilityList();

        for (int j = 0; j < ptSets.Count; j++)
        {
            if (!setVisible[j])
            {
                continue;
            }
            List <Vector3> pts = ptSets[j];
            Vector3        midPt;

            foreach (Vector3 pt in pts)
            {
                base.createAndPlaceSnapObj(pt, pt, SnapType.END);
            }

            for (int i = 0; i < pts.Count - 1; i++)
            {
                base.createAndPlaceSnapObj(pts[i], pts[i + 1]);
                midPt = (pts[i] + pts[i + 1]) / 2;
                base.createAndPlaceSnapObj(midPt, midPt, SnapType.MID);
            }

            // the fourth side
            base.createAndPlaceSnapObj(pts[pts.Count - 1], pts[0]);
            midPt = (pts[pts.Count - 1] + pts[0]) / 2;
            base.createAndPlaceSnapObj(midPt, midPt, SnapType.MID);
        }
    }
Beispiel #2
0
    //---------------------------------------------------------------



    private void recreateMeshObjects()
    {
        List <List <Vector3> > cornerPoints   = refObj.getAllPtSets();
        List <bool>            visibilityList = refObj.getAllVisibilityList();
        float halfThickness = refObj.getHalfThickness();
        int   subMeshCount  = cornerPoints.Count;

        for (int i = 0; i < subMeshCount; i++)
        {
            if (!visibilityList[i])
            {
                continue;                     // dont create meshes with visibility marked off
            }
            GameObject meshObj = GameObject.CreatePrimitive(PrimitiveType.Quad);
            Material   defMat  = Resources.Load("Materials/White", typeof(Material)) as Material;
            meshObj.GetComponent <MeshRenderer>().material = defMat;
            meshObj.transform.SetParent(transform);
            Mesh newMesh = getBoxMesh(cornerPoints[i], halfThickness);
            meshObj.GetComponent <MeshFilter>().mesh         = newMesh;
            meshObj.GetComponent <MeshCollider>().sharedMesh = newMesh;
        }
        // method call yo update the real material array in highlight script since the model has changed
        parentCloneObj.GetComponent <HighlightStyle1>().setupRealMaterialArray();
    }