Why doesn't my cube hold a position?

Posted by Christian Frantz on Game Development See other posts from Game Development or by Christian Frantz
Published on 2013-06-29T20:20:04Z Indexed on 2013/06/29 22:29 UTC
Read the original article Hit count: 313

Filed under:
|

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

© Game Development or respective owner

Related posts about XNA

Related posts about c#