public void Simulate() { GameObject go = new GameObject("A piece of cloth"); DeformObject deformObject = go.AddComponent <DeformObject>(); go.transform.parent = deformManager.transform.parent; go.transform.localPosition = new Vector3(0, 1, 0); go.transform.localRotation = Quaternion.AngleAxis(90, new Vector3(1, 0, 0)); Mesh mesh = clothModels[0].GetComponent <BoundaryPointsHandler>().GetComponent <MeshFilter>().sharedMesh; //deformObject.SetMesh(mesh); //deformObject.SetMaterial(garmentMaterial); deformObject.mesh = mesh; deformObject.material = garmentMaterial; //deformManager.Reset(); ////////////// //yolo ///////////// List <int> yobro = VibbiMeshUtils.DefineSeamFromLines(clothModels[1].GetComponent <BoundaryPointsHandler>().boundaryLines[0], clothModels[0].GetComponent <BoundaryPointsHandler>().boundaryLines[1]); Debug.Log(yobro.Count); for (int i = 0; i < yobro.Count; i += 2) { Debug.Log(yobro[i] + " " + yobro[i + 1]); } }
public void StartSimulation() { foreach (GameObject o in clothPieces) { Mesh mesh = o.GetComponent <MeshFilter>().sharedMesh; DeformObject deformObject = o.AddComponent <DeformObject>(); deformObject.originalMesh = mesh; deformObject.material = o.GetComponent <MeshRenderer>().material; deformObject.AddToSimulation(); } deformManager.Reset(); }