and my question is
Code: Select all
camera->setPosition(core::vector3df(2700*2,255*2,2600*2));Code: Select all
camera->setPosition(core::vector3df(2700*2,255*2,2600*2));trial and error !?Elfinitiy wrote:But how to calculate the middle of the terrain ?

The heightmap being used is "terrain-heightmap.bmp" which is 256x256. and we scale it by 40 units in the X, Z direction,scale,: The scale factor for the terrain. If you're using a heightmap of size 129x129 and would like your terrain to be 12900x12900 in game units, then use a scale factor of ( core::vector ( 100.0f, 100.0f, 100.0f ). If you use a Y scaling factor of 0.0f, then your terrain will be flat.
So the terrain scene node is a bit over 10,000x10,000 units?// add terrain scene node
scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(
"../../media/terrain-heightmap.bmp",
0, // parent node
-1, // node id
core::vector3df(0.f, 0.f, 0.f), // position
core::vector3df(0.f, 0.f, 0.f), // rotation
core::vector3df(40.f, 4.4f, 40.f), // scale <--here!
video::SColor ( 255, 255, 255, 255 ), // vertexColor
5, // maxLOD
scene::ETPS_17, // patchSize
4 // smoothFactor
);
which would be like x=5400, z=5200 (in reduced terms) which is approximately the middle.camera->setPosition(core::vector3df(2700*2,255*2,2600*2));