Scaling cube nodes.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Chris.Bailey
Posts: 9
Joined: Thu Aug 14, 2008 7:20 am

Scaling cube nodes.

Post by Chris.Bailey »

I'm having a bit of a problem when scaling cube nodes. In the following code I am making an array of cube nodes with an adjustable height (based on vertical scale). The best that I can tell when a cube node is scaled vertically it extends upward AND downward, and I would like to correct that. I tried diving the scale by 2 for each cube node and setting the y axis coord as the result, but it has had no affect. I would like to keep the bottoms of these nodes all lined up =)

Code: Select all


struct sector
{
	sector() : height(1){}
	ISceneNode* cube;
	int height;
};

sector nMap[10][10];


.........All unrelated code in this area.


for (int x=0; x<10; x++)
    	for (int y=0; y<10; y++) {
      		nMap[x][y].cube = smgr->addCubeSceneNode(10.0f, NULL, -1, core::vector3df(x*10,nMap[x][y].height/2,y*10));
      		nMap[x][y].cube->setScale(vector3df(1,nMap[x][y].height,1));
      		nMap[x][y].cube->getMaterial(0).setTexture(0,video->getTexture("square.bmp"));
      		nMap[x][y].cube->getMaterial(0).Lighting = false; 
  		} 

Post Reply