public bool InitInputs() { // Initialize input vertices and triangles. if (!GameObjectToEdit) { Debug.Log("No gameobject to edit"); return(false); } else { meshToWorldMatrix = GameObjectToEdit.transform.localToWorldMatrix; MeshFilter mf = GameObjectToEdit.GetComponent <MeshFilter>(); if (!mf) { Debug.Log("The gameobject to edit has no mesh filter !"); return(false); } else { InputVertices = LocalToWorldMeshVertices(mf.mesh.vertices); inputTriangles = mf.mesh.triangles; } } inputsInitialized = true; return(true); }
void CreateCutMeshes() { // If we have cut something, setup two new meshes. if (trianglesToCut.Count > 0) { GameObjectToEdit.GetComponent <MeshFilter>().mesh.SetTriangles(trianglesToKeep, 0, true); CreateCutMesh(); } else { // Inform the user that nothing was cut Debug.Log("Nothing to cut buddy ;)"); } }