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.
Catprog
Posts: 164 Joined: Wed Jan 31, 2007 9:07 am
Contact:
Post
by Catprog » Wed Jan 31, 2007 9:10 am
The question I have is why does this happen(referring to the gap between the 2 terains)
[url=
http://img374.imageshack.us/my.php?image=tempva8.gif ][img=
http://img374.imageshack.us/img374/2211/tempv
Code: Select all
scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(
"media/terrain-heightmap.bmp");
terrain->setScale(core::vector3df(40, 4.4f, 40));
terrain->setMaterialFlag(video::EMF_LIGHTING, false);
terrain->setMaterialTexture(0, driver->getTexture("media/terrain-texture.jpg"));
terrain->setMaterialTexture(1, driver->getTexture("media/detailmap3.jpg"));
terrain->setMaterialType(video::EMT_DETAIL_MAP);
terrain->scaleTexture(1.0f, 20.0f);
v = terrain->getScale;
int Ter1Width = v.X;
scene::ITerrainSceneNode* terrain2 = smgr->addTerrainSceneNode(
"media/terrain-heightmap2.bmp");
terrain2->setScale(core::vector3df(40, 4.4f, 40));
terrain2->setMaterialFlag(video::EMF_LIGHTING, false);
terrain2->setMaterialTexture(0, driver->getTexture("media/terrain-texture.jpg"));
terrain2->setMaterialTexture(1, driver->getTexture("media/detailmap3.jpg"));
terrain2->setMaterialType(video::EMT_DETAIL_MAP);
terrain2->scaleTexture(1.0f, 20.0f);
v = terrain2->getPosition();
v.X += Ter1Width;
terrain2->setPosition(v);
harukiblue
Posts: 49 Joined: Sun Dec 10, 2006 6:23 pm
Post
by harukiblue » Wed Jan 31, 2007 4:38 pm
it could be that when you scale the meshs with
Code: Select all
setScale(core::vector3df(40, 4.4f, 40));
that the meshes maintain there origin at the center. This means you would have to reposition the meshes after you scale them.
you can use the following to repostion the meshes.
Code: Select all
virtual void irr::scene::ISceneNode::setPosition ( const core::vector3df & newpos )
Catprog
Posts: 164 Joined: Wed Jan 31, 2007 9:07 am
Contact:
Post
by Catprog » Wed Jan 31, 2007 11:15 pm
harukiblue wrote: it could be that when you scale the meshs with
Code: Select all
setScale(core::vector3df(40, 4.4f, 40));
that the meshes maintain there origin at the center. This means you would have to reposition the meshes after you scale them.
you can use the following to repostion the meshes.
Code: Select all
virtual void irr::scene::ISceneNode::setPosition ( const core::vector3df & newpos )
Have a look at the last line:
Catprog
Posts: 164 Joined: Wed Jan 31, 2007 9:07 am
Contact:
Post
by Catprog » Thu Feb 01, 2007 10:09 am
If I use 9600 instead of Ter1Width it works
harukiblue
Posts: 49 Joined: Sun Dec 10, 2006 6:23 pm
Post
by harukiblue » Thu Feb 01, 2007 12:30 pm
sorry about that, yea it looks like Ter1Width is always 0. making it uneffective. Good call mate