// Use this for initialization void Start() { main = GameObject.Find("Main").GetComponent <Main> (); // NOOOOT GOOD CHANGE THIS SHIT: CALLBACK WFROM MAIN ???? spectrumList = new List <SpectrumObject[]>(); for (int i = 0; i < maxObjects; i++) { SpectrumObject[] currentRowOfObjects = new SpectrumObject[spectrumRows]; for (int o = 0; o < spectrumRows; o++) { if (tunnelGrid == true) { /* Tunnel CALC */ currentRowOfObjects[o] = new SpectrumObject { TimeInSong = (float)i, Amplitude = 1f, Object = Instantiate(myPrefab, new Vector3(0, 0, 0), Quaternion.identity), indexInRow = o, numberOfObjects = spectrumRows, radiusOuter = outerRadius, radiusInner = innerRadius }; currentRowOfObjects[o].updateMesh(currentRowOfObjects[o].tunnelMeshPoints()); currentRowOfObjects[o].updateRotation(); /*Vector3 gridPos = new Vector3(0, 0, i); * float angle = o * Mathf.PI * 2 / spectrumRows; * float x = Mathf.Cos(angle) * radius; * float y = Mathf.Sin(angle) * radius; * Vector3 tunnelPos = gridPos + new Vector3(x, y, 0); * float angleDegrees = +angle*Mathf.Rad2Deg+90; * Quaternion rot = Quaternion.Euler(0, 0, angleDegrees); * currentRowOfObjects[o] = new SpectrumObject { TimeInSong = (float) i, Object = Instantiate(myPrefab, tunnelPos, rot) };*/ } else { // Old grid calculation Vector3 gridPos = new Vector3(o, 0, i); // old: Don't need x -> new x by circle currentRowOfObjects[o] = new SpectrumObject { TimeInSong = (float)i, Object = Instantiate(myPrefab, gridPos, Quaternion.identity) }; } } spectrumList.Add(currentRowOfObjects); } }
// Use this for initialization void Start() { main = GameObject.Find("Main").GetComponent <Main> (); // NOOOOT GOOD CHANGE THIS SHIT: CALLBACK WFROM MAIN ???? spectrumList = new List <SpectrumObject[]>(); float radius = 40f; for (int i = 0; i < maxObjects; i++) { SpectrumObject[] currentRowOfObjects = new SpectrumObject[spectrumRows]; for (int o = 0; o < spectrumRows; o++) { if (tunnelGrid == true) { /* CIRCULAR CALC */ Vector3 gridPos = new Vector3(0, 0, i); float angle = o * Mathf.PI * 2 / spectrumRows; float x = Mathf.Cos(angle) * radius; float y = Mathf.Sin(angle) * radius; Vector3 tunnelPos = gridPos + new Vector3(x, y, 0); float angleDegrees = +angle * Mathf.Rad2Deg + 90; Quaternion rot = Quaternion.Euler(0, 0, angleDegrees); currentRowOfObjects[o] = new SpectrumObject { TimeInSong = (float)i, Object = Instantiate(myPrefab, tunnelPos, rot) }; } else { // Old grid calculation Vector3 gridPos = new Vector3(o, 0, i); // old: Don't need x -> new x by circle currentRowOfObjects[o] = new SpectrumObject { TimeInSong = (float)i, Object = Instantiate(myPrefab, gridPos, Quaternion.identity) }; } } spectrumList.Add(currentRowOfObjects); } }