IEnumerator BuildMeshes() { yield return(null); for (int i = 0; i < fracturePoints.Count; i++) { if (i != gizmoPolyIndex && gizmoPolyIndex != -1) { continue; } Polygon3D poly = new Polygon3D(fracturePoints[i][0], fracturePoints[i][1], fracturePoints[i][2]); //Polygon3D poly = new Polygon3D(fracturePoints[i]); MeshFilter filt = mc3D.createMesh(poly); for (int j = 3; j < fracturePoints[i].Count; j++) { while (!Input.GetMouseButtonUp(1)) { yield return(null); } Debug.Log("poly " + i + " : add point (" + fracturePoints[i][j].x + ", " + fracturePoints[i][j].y + ", " + fracturePoints[i][j].z + ") number of vertices : " + poly.points.Count + "/" + fracturePoints[i].Count); poly.addPoint(fracturePoints[i][j]); mc3D.updateMesh(poly, filt); yield return(null); } } }
private void Start() { convexHull = new Polygon3D(points); meshCreator = new MeshCreator3D(); meshCreator.createMesh(convexHull); for (int i = 0; i < points.Count; i++) { pointsTR.Add(Instantiate <GameObject>(newPointTR)); pointsTR[i].transform.localScale *= 0.5f; pointsTR[i].transform.position = points[i]; pointsTR[i].GetComponent <Renderer>().material.color = new Color(0, 1, 0, 0.5f); } newPointTR.transform.position = newPoint; }