// Use this for initialization void Start() { constrainedVertices = new ArrayList(); originalMesh = GetComponent <MeshFilter>().mesh; clothVertices = originalMesh.vertices; cloth = new ClothVertex[clothVertices.Length]; for (int i = 0; i < clothVertices.Length; i++) { if (!checkconstraints(clothVertices[i])) { constrainedVertices.Add(i); } cloth[i] = new ClothVertex(i, transform.localToWorldMatrix.MultiplyPoint(clothVertices[i])); } for (int i = 0; i < cloth.Length; i++) { cloth[i].addNeighbors(cloth, originalMesh.triangles); cloth[i].radius /= 1.5f; } }
public NeighborVertex(ClothVertex v, float d) { neighbor = v; distance = d; }