Terain Tile Question

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
Catprog
Posts: 164
Joined: Wed Jan 31, 2007 9:07 am
Contact:

Terain Tile Question

Post by Catprog »

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

Posible problem

Post by harukiblue »

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   ) 
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

yes u must re postion them !! :D :D :D :D
Catprog
Posts: 164
Joined: Wed Jan 31, 2007 9:07 am
Contact:

Re: Posible problem

Post by Catprog »

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:

Code: Select all

 terrain2->setPosition(v);
Catprog
Posts: 164
Joined: Wed Jan 31, 2007 9:07 am
Contact:

Post by Catprog »

If I use 9600 instead of Ter1Width it works
harukiblue
Posts: 49
Joined: Sun Dec 10, 2006 6:23 pm

woops

Post by harukiblue »

sorry about that, yea it looks like Ter1Width is always 0. making it uneffective. Good call mate :lol:
Catprog
Posts: 164
Joined: Wed Jan 31, 2007 9:07 am
Contact:

Post by Catprog »

The image above was generated with the code.

It didn't link so here is the url
http://img374.imageshack.us/my.php?image=tempva8.gif
Post Reply