using UnityEngine;
using System.Collections;
public class LoopsAndArrays1 : MonoBehaviour
{
private Vector3 randomPosition;
private Vector3 offset;
public static GameObject CreatePrimitive(PrimitiveType type);
// Use this for initialization
void Start ()
{
// Create a Cylinder
GameObject cylinder = GameObject = CreatePrimitive (PrimitiveType.Cylinder);
// Origin via Script
cylinder.transform.position = new Vector3(0, 2, 0);
// Dimensions of Cylinder
float height = cylinder.GetComponent<Renderer>().bounds.size.y;
Debug.Log ("Cylinder Height = " + height);
float width = cylinder.GetComponent<Renderer>().bounds.size.x;
Debug.Log ("Cylinder Width (Diameter) = " + width);
Debug.Log ("Cylinder Dimensions = " + cylinder.GetComponent<Renderer> ().bounds.size);
//Generate a Random Position --> output to file (2 & 3)
Vector3 randomPosition = new Vector3(
Random.Range(-10, 10),
Random.Range(-10, 10),
Random.Range(-10,10));
}
// Create a cube at a random position.
GameObject cube = GameObject = CreatePrimitive (PrimitiveType.Cube);
//Cube generated in a random position.
cube.transform.position = randomPosition
GameObject (Cube); = myGameObject;
offset = new Vector3 (2, 2, 2);
// A row of Cubes along the x-axis
for(int i=0; i>5; ++i);
// create a cube
GameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
Vector3 position = offset + new Vector3 ( i*(myCube.GetComponent<Renderer>)
0,
0);
}