Working on generating a 3D GameObject Array of cubes grid-locked and angled to match the initial rotation. Although all of my objects spawn in the correct rotation, the grid itself is world-aligned.

The grid is populated by the bottom-left most grid piece and then placed accordingly.

**Noteworthy Global Variables:**

```
public float GridLength = 3.5f;
GameObject[,,] Grid;
Vector3 Rotation = Vector3.zero;
Vector3 PointA = Vector3.zero;
Vector3 PointB = Vector3.zero;
```

**Important Snippet (in Update)**

```
// Gridlock scale to point B
int a = Mathf.RoundToInt((PointB.x-PointA.x)/GridLength), // difference in X length
b = Mathf.RoundToInt((PointB.y-PointA.y)/GridLength)+1, // difference in Y length
c = Mathf.RoundToInt((PointB.z-PointA.z)/GridLength); // difference in Z length
if (Grid.Length != a*b*c && (Mathf.Abs(a*b*c) > 0)) {
Debug.Log("Size Changed. Grid["+a+","+b+","+c+"]");
// clear grid
foreach(GameObject o in Grid) {
Destroy (o);
}
// repopulate grid
Grid = new GameObject[Mathf.Abs(a),Mathf.Abs(b),Mathf.Abs(c)];
for (int k = Mathf.Min(0, c+1); k < Mathf.Max(c, 0); k ++) {
for (int j = Mathf.Min(0, b+1); j < Mathf.Max(b, 0); j ++) {
for (int i = Mathf.Min(0, a+1); i < Mathf.Max(a, 0); i ++) {
try {
Grid[Mathf.Abs(i),Mathf.Abs(j),Mathf.Abs(k)] = GameObject.Instantiate(Prefab, PointA+new Vector3(i*GridLength, j*GridLength, k*GridLength), Quaternion.Euler(Rotation)) as GameObject;
Grid[Mathf.Abs(i),Mathf.Abs(j),Mathf.Abs(k)].transform.GetComponent<BoxCollider>().enabled = false;
} catch {
Debug.LogError("Error creating Grid["+Mathf.Abs(i)+","+Mathf.Abs(j)+","+Mathf.Abs(k)+"]");
}
}
}
}
```

I need to align this based on the Rotation vector (EulerAngles).