//End m2 public void Generation() { if (points.Count >= 3) { points.Add(points[0]); lineRenderer.positionCount += 1; lineRenderer.SetPosition(transform.childCount - 1, lineRenderer.GetPosition(0)); Poly2Mesh.Polygon poly = new Poly2Mesh.Polygon(); poly.outside = points; // Set up game object with mesh; GameObject gob = new GameObject(); gob.name = "Polygon"; gob.tag = "Polygon"; gob.AddComponent(typeof(MeshRenderer)); MeshFilter filter = gob.AddComponent(typeof(MeshFilter)) as MeshFilter; GameObject polyMesh = Poly2Mesh.CreateGameObject(poly); filter.mesh = polyMesh.GetComponent <MeshFilter>().mesh; if (filter != null) { Mesh mesh2 = filter.mesh; Vector3[] normals = mesh2.normals; for (int i = 0; i < normals.Length; i++) { normals[i] = -normals[i]; } mesh2.normals = normals; for (int m = 0; m < mesh2.subMeshCount; m++) { int[] triangles = mesh2.GetTriangles(m); for (int i = 0; i < triangles.Length; i += 3) { int temp = triangles[i + 0]; triangles[i + 0] = triangles[i + 1]; triangles[i + 1] = temp; } mesh2.SetTriangles(triangles, m); } } //gob.AddComponent<BoxCollider>().size = new Vector3(1f, 1f, 0.001f); //m2 areaSum = AreaOfMesh(polyMesh.GetComponent <MeshFilter>().sharedMesh); xyArea = areaSum; txt_areaSum.text = "~ " + areaSum.ToString("#.##") + " m2"; if (areaSum < 1) { txt_areaSum.text = "~ 0" + areaSum.ToString("#.##") + " m2"; } _changeMaterial.work = true; start = true; lineRenderer.positionCount = 0; punkDot.positionCount = 0; ClearAllDots(); _changeMaterial.Material1(); _swipeAnim.UpSwipe(); first_Toturial = false; _TextBox_3.SetActive(false); _TextBox_1.SetActive(false); _TextBox_2.SetActive(false); _TextBox_4.SetActive(false); first_Box_1 = false; first_Box_2 = false; first_Box_3 = false; first_Box_4 = false; _ToturialUI.SetActive(false); } }