예제 #1
0
		public MeshGrid (int size, Vector3 center)
		{
			gridItems = new MeshGridItem[size,size,size];
			bounds = new Bounds (center, new Vector3 (size, size, size));	
			float startXPos = bounds.center.x + bounds.extents.x - 0.5f;
			float startYPos = bounds.center.y + bounds.extents.y - 0.5f;
			float startZPos = bounds.center.z + bounds.extents.z - 0.5f;
		
			for (int x=0; x<size; x++) {
				for (int y=0; y<size; y++) {
					for (int z=0; z<size; z++) {
						Vector3 newCenter = new Vector3 (startXPos - x, startYPos - y, startZPos - z);
						MeshGridItem item = new MeshGridItem (1.0f, newCenter, new Vector3 (x, y, z));
						gridItems[x,y,z]=item;
					}
				}
			}
		}
예제 #2
0
파일: MeshGrid.cs 프로젝트: daseyb/chill-c
        public MeshGrid(int size, Vector3 center)
        {
            gridItems = new MeshGridItem[size, size, size];
            bounds    = new Bounds(center, new Vector3(size, size, size));
            float startXPos = bounds.center.x + bounds.extents.x - 0.5f;
            float startYPos = bounds.center.y + bounds.extents.y - 0.5f;
            float startZPos = bounds.center.z + bounds.extents.z - 0.5f;

            for (int x = 0; x < size; x++)
            {
                for (int y = 0; y < size; y++)
                {
                    for (int z = 0; z < size; z++)
                    {
                        Vector3      newCenter = new Vector3(startXPos - x, startYPos - y, startZPos - z);
                        MeshGridItem item      = new MeshGridItem(1.0f, newCenter, new Vector3(x, y, z));
                        gridItems[x, y, z] = item;
                    }
                }
            }
        }