GenerateTreeMesh newBranch(Vector3 pos, Vector3 dir, GameObject prefab) { GenerateTreeMesh tm = GameObject.Instantiate(prefab, Parent).GetComponent <GenerateTreeMesh>(); for (int i = 0; i < tm.branchh.Positions.Count; i++) { tm.branchh.Positions[i] = dir * i + pos; } tm.branchh.growthVector = new List <Vector3>(); tm.Initialise(); return(tm); }
private void LateUpdate() { if (isGworing) { if (b) { grow(); mainStump.Initialise(); trackPos = mainStump.branchh.Positions[mainStump.branchh.Positions.Count - 1]; if (mainStump.branchh.newSectionReq < 0) { trackPos = Vector3.up; } b = false; } else { b = true; } } }