//Placing a serise of object that will be come the points that //vertex points exist in when the mesh is created void runCreation() { int iterCounter = 0; int endAdjuster = 0; if (frequency <= 0 || items == null || items.Length == 0) { return; } float testValForEnd = 0; float stepSize = 1f / (frequency * items.Length); for (int p = 0, f = 0; f < frequency; f++) { if (iterCounter++ > 9) { endAdjuster += 4; } //for all the childern of the inital shape for (int i = 0; i < items.Length; i++, p++) { item = Instantiate(items[0]) as GameObject; vertexPoints.Add(item); if (f == frequency - 2) { testValForEnd = 1.5f; } else if (f == frequency - 1) { testValForEnd = testValForEnd * 2; } //a small fudge to correct rotations if (adjustZ) { Transform tr = item.transform.GetChild(3).transform; tr.position = tr.position = new Vector3((testVal + (p / 10) - testValForEnd), (tr.position.y), ((-zchange - 10) + endAdjuster)); tr = item.transform.GetChild(4).transform; tr.position = tr.position = new Vector3((testVal + (p / 10) - testValForEnd), (tr.position.y), ((-zchange - 10) + endAdjuster)); } Destroy(item); Vector3 position = spline.GetPoint(p * stepSize); item.transform.localPosition = position; if (lookForward) { item.transform.LookAt(position + spline.GetDirection(p * stepSize)); } item.transform.parent = transform; } foreach (Transform child in item.transform) { vertexPoints.Add(child.gameObject); Destroy(child.gameObject); } } //activate the mesh making process with the current vertex points shapeHold.createMesh(); }