
Another things.. it seems that only loads one square of the Terrain.. maybe it's somethinhg easy to fix ... but i really didn't look at that...
Code: Select all
void SetGround(IrrlichtDevice *dev1,ShTlTerrainSceneNode *ground1){
if(ground1){
MyDevice=dev1;
if(ground1==MyFloorTerrain)return;
MyFloorTerrain=ground1;
MyFloor = MyDevice->getSceneManager()->createTerrainTriangleSelector(ground1, 0);
}
}
Code: Select all
ShTlTerrainSceneNode* terrain = new ShTlTerrainSceneNode(smgr, 255, 255, 1, 100);
terrain->drop();
// load height data from texture
terrain->loadHeightMap("media/mapafinal2.bmp", 10);
// load color map
terrain->loadColorMap("media/nokturna_TX.jpg");
// set detail texture
terrain->setMaterialTexture(0, driver->getTexture("media/detailmap3.jpg"));
// smooth normals
terrain->smoothNormals();
terrain->setMaterialFlag(video::EMF_LIGHTING, false);
Code: Select all
vector3df pos = playernode->getPosition();
f32 height = terrain->getHeight(pos.X, pos.Z);
pos.Y = height + offset;
playernode->setPosition(pos);
Code: Select all
f32 ShTlTerrainSceneNode::getHeight(u32 w, u32 h)
{
return Data(w,h).Height;
}
please, describe what it means exactly in more detail.my real problem is that the terrain is not loading entirely
describe that more too, I dont realy get what your problem is. Do you mean height map texture?it seems that the texture is loaded as a plane square... but if i move around... the node get the right height for the terrain... for one reason... it's not working properly and i can't figure out why
No problem, thats for what this forum is, place to ask questions and get answers. I'm glad to help. Many people helped me the same way.Sorry for all this questions
It works, I am using triangle selectors with your terrain in my project. I will post the code here when I will have some spare time.I dont know if Irrlicht TriangleSelector will work with my terrain node. It was not intended to. For placing Sidney on terrain use code monkeycracks was posting here. It places Sidney on the terrain. You may need to use some offset however if origin of Sidney model is in its center and not at its feet (witch seems to be problem on your screenshots):
Ok.. i'll try itarras wrote: varholl >> you are using wrong function. One you are using is f32 ShTlTerrainSceneNode::getHeight(u32 w, u32 h) which return height of tile corners. You need to use f32 ShTlTerrainSceneNode::getHeight(core::vector3df pos) which accepts position in 3D (can be your player node) and returns real height of terrain at that place.
Well.. let me explain it better (sorry but english is not my mother tongarras wrote:please, describe what it means exactly in more detail.my real problem is that the terrain is not loading entirely
Maybe my problem was that getHeight... if i can resolve my last issue this will be resolved to..arras wrote:describe that more too, I dont realy get what your problem is. Do you mean height map texture?it seems that the texture is loaded as a plane square... but if i move around... the node get the right height for the terrain... for one reason... it's not working properly and i can't figure out why
Code: Select all
ShTlTerrainSceneNode* terrain = new ShTlTerrainSceneNode(smgr, width, height, tilesize, visiblemeshsize);
Code: Select all
ShTlTerrainSceneNode* terrain = new ShTlTerrainSceneNode(smgr, 255, 127, 10, 50);
Code: Select all
terrain->loadHeightMap("heightmap.bmp", 10, 0, 0);
Code: Select all
ShTlTerrainSceneNode* terrain = new ShTlTerrainSceneNode(smgr, 255, 255, 10, 50);
terrain->loadHeightMap("heightmap1.bmp", 10, 0, 0);
terrain->loadHeightMap("heightmap2.bmp", 10, 128, 0);
terrain->loadHeightMap("heightmap3.bmp", 10, 0, 128);
terrain->loadHeightMap("heightmap4.bmp", 10, 128, 128);