Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (cube)
        {
            mesh = cube.GetComponent <MeshFilter>().mesh;
        }

        if (change)
        {
            Vector3[] vertices = new Vector3[vertexNum];
            int[]     faces    = new int[faceNum * 3];
            contactor.GetInfo(Contactor.Info.Vertex, vertices);
            contactor.GetInfo(Contactor.Info.Face, faces);

            mesh.triangles = faces;

            //Vector3[] newVertices = new Vector3[tmpVertex.Length];
            //for (int i = 0; i < faceNum * 3; i += 3)
            //{
            //    for (int j = 0; j < 3; j++)
            //        newVertices[mesh.triangles[i + j]] = vertices[faces[i + j]] * 0.01f;

            //}
            mesh.vertices = vertices;
            mesh.RecalculateNormals();
            Debug.Log(mesh.vertexCount);
            change = false;
        }
    }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        Vector3[] verts = new Vector3[7366];
        int[]     faces = new int[14496 * 3];

        meshFilter = GetComponent <MeshFilter>();
        Mesh mesh = new Mesh();

        Debug.Log(contactor.viewAccessor == null);
        //contactor.viewAccessor.ReadArray(contactor.GetInfoOffset(Contactor.Info.Vertex), verts, 0, contactor.vert);
        //contactor.viewAccessor.ReadArray(contactor.GetInfoOffset(Contactor.Info.Face), faces, 0, contactor.face * 3);
        contactor.GetInfo(Contactor.Info.Vertex, verts);
        contactor.GetInfo(Contactor.Info.Face, faces);
        mesh.vertices  = verts;
        mesh.triangles = faces;
        mesh.RecalculateBounds();
        mesh.RecalculateNormals();

        meshFilter.mesh = mesh;
    }
Example #3
0
    void Transfer()
    {
        if (refresh)
        {
            //refresh = false;
            for (int i = 0; i < 72; i++)
            {
                pose[i] += (Random.value - 0.5) * 0.01;
            }
        }

        double[] tmp = new double[79];
        contactor.GetInfo(Contactor.Info.SelfDefine, tmp, 79);
        target.SetInfo(Contactor.Info.SelfDefine, pose, 72);
    }