Why doesn't my cube hold a position?
- by Christian Frantz
I gave up a previous method of creating cubes so I went with a list to hold my cube objects. The list is being populated from an array like so:
#region MAP
float[,] map =
{
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}
};
#endregion MAP
for (int x = 0; x < mapWidth; x++)
{
for (int z = 0; z < mapHeight; z++)
{
cubes.Add(new Cube(device, new Vector3(x, map[x,z], z), Color.Green));
}
}
The cube follows all the parameters of what I had before. This is just easier to deal with. But when I debug, every cube has a position of (0, 0, 0) and there's just one black cube in the middle of my screen. What could I be doing wrong here?
public Vector3 cubePosition { get; set; }
public Cube(GraphicsDevice graphicsDevice, Vector3 Position, Color color)
{
device = graphicsDevice;
color = Color.Green;
Position = cubePosition;
SetUpIndices();
SetUpVerticesArray();
}
That's the cube constructor. All variables are being passed correctly I think