Example #1
0
    //创建控制点
    public void CreateEditorPoint()
    {
        positionList = new List <Vector3>(mesh.vertices);

        for (int i = 0; i < mesh.vertices.Length; i++)
        {
            string vstr = Vector2String(mesh.vertices[i]);

            if (!pointmap.ContainsKey(vstr))
            {
                pointmap.Add(vstr, new List <int>());
            }
            pointmap[vstr].Add(i);
        }

        foreach (string key in pointmap.Keys)
        {
            GameObject editorpoint = (GameObject)Resources.Load("Prefabs/MeshEditor/MeshEditorPoint");
            editorpoint = Instantiate(editorpoint);
            editorpoint.transform.parent        = transform;
            editorpoint.transform.localPosition = String2Vector(key);
            editorpoint.transform.localScale    = new Vector3(1f, 1f, 1f);

            MeshEditorPoint editorPoint = editorpoint.GetComponent <MeshEditorPoint>();
            editorPoint.onMove  = PointMove;
            editorPoint.pointid = key;

            positionObjList.Add(editorpoint);
        }
    }
Example #2
0
    //创建控制点
    public void CreateEditorPoint()
    {
        positionList = new List <Vector3>(mesh.vertices);

        for (int i = 0; i < mesh.vertices.Length; i++)
        {
            string vstr = Vector2String(mesh.vertices[i]);

            if (!pointmap.ContainsKey(vstr))
            {
                pointmap.Add(vstr, new List <int>());
            }
            pointmap[vstr].Add(i);
        }
        Debug.LogWarning("start pointmap");
        foreach (string key in pointmap.Keys)
        {
            editorpoint = Instantiate(editorpoint);
            editorpoint.transform.parent        = transform;
            editorpoint.transform.localPosition = String2Vector(key);
            editorpoint.transform.localScale    = new Vector3(pointScale, pointScale, pointScale);

            MeshEditorPoint editorPoint = editorpoint.GetComponent <MeshEditorPoint>();
            Debug.Log("editorPoint" + (editorPoint == null));
            editorPoint.onMove  = PointMove;
            editorPoint.pointid = key;

            positionObjList.Add(editorpoint);
        }
    }