I have an Empty gameObject that creates 20 objects at the start of the game.
var houses:Array = new Array();
var hs:Transform;
function Start ()
{
for(var a:int = 0; a < 20; a++)
{
ex = Random.Range(-200, 201);
zee = Random.Range(-200, 201);
newPos = Vector3(ex, 400, zee);
newhs = Instantiate(hs, newPos, transform.rotation);
houses.Push(newhs);
}
}
How can I make sure that all of the objects are a certain distance from each other?
I know it probably involves a for-loop inside the initial for-loop to check the distances. Anyone have an example script? Or an idea of what i can do? Thanks
↧