2075 / Unity / 3D / Генератор
public GameObject obj;
public int countX = 5;
public int countY = 5;
public int countZ = 5;
public float stepX = 2f;
public float stepY = 2f;
public float stepZ = 2f;
public float randX = 0.5f;
public float randY = 0.5f;
public float randZ = 0.5f;
Vector3 tmp;
void Start()
{
Vector3 pos = transform.position;
for (int i = 0; i < countX; i++)
{
for (int j = 0; j < countY; j++)
{
for (int k = 0; k < countZ; k++)
{
tmp = new Vector3(Random.Range(-randX, randX), Random.Range(-randY, randY), Random.Range(-randZ, randZ));
Instantiate(obj, pos + tmp, Quaternion.identity);
pos += new Vector3(0f, 0f, stepZ);
}
pos += new Vector3(0f, stepY, -stepZ * countZ);
}
pos += new Vector3(stepX, -stepY * countY, 0f);
}
}