private void GenerateObjects(List <GravityObject> L_GOs) { for (int i = 0; i < L_GOs.Capacity; i++) { //Debug.Log("GenerateObjects()#1: L_GOs.Capacity = " + L_GOs.Capacity); //Debug.Log("GenerateObjects()#2: for(): i = " + i); L_GOs[i].mass = Random.Range(minimumMass, maximumMass); // randomize radius via mass L_GOs[i].Refresh(); // update radius, localScale L_GOs[i].rigidbody = L_GOs[i].GetComponent <Rigidbody>(); float maximumEndToEnd = GravityObject.calcRadius(maximumMass) * L_GOs.Capacity; Vector3 location = new Vector3(Random.Range(-maximumEndToEnd, maximumEndToEnd), Random.Range(-maximumEndToEnd, maximumEndToEnd), Random.Range(-maximumEndToEnd, maximumEndToEnd)); L_GOs[i].transform.position = location; //L_GOs[i].transform.position = new Vector3(0,0,0); /* * // check for any overlaps so far, and resolve if so * for(int h = 0; h < i; h++) { * if(GravityObject.verifyOverlap(L_GOs[h], L_GOs[i])) { * D6Relocate(L_GOs[h], L_GOs[i]); * Debug.Log("Relocated a GravityObject that generated inside another one!"); * } * } */ L_GOs[i].rigidbody.velocity = new Vector3(Random.Range(-.1f, .1f), Random.Range(-.1f, .1f), Random.Range(-.1f, .1f)); L_GOs[i].gameObject.SetActive(true); // reactivate after positioning } }