[SOLVED] Height function problem


10-11-2007 15:12:03

Hi John,

i have to ask might save me a week of trying to work it out, i'm using PLSM2 and i'v just added Pagedgeometry, i'm not getting any error's but i have a small few small problems you might be able to help me with, My problem is


i used the example on the wiki which has a function using RaySceneQuery to get the y value the function on the wiki is

float getTerrainHeight(float x, float z)
static Ray updateRay;

updateRay.setOrigin(Vector3(x, 10000, z));
app -> raySceneQuery->setRay(updateRay);
app -> raySceneQuery->setQueryTypeMask(Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK);
app -> raySceneQuery->setWorldFragmentType(SceneQuery::WFT_SINGLE_INTERSECTION);

RaySceneQueryResult& qryResult = app -> raySceneQuery->execute();
RaySceneQueryResult::iterator i = qryResult.begin();
if (i != qryResult.end() && i->worldFragment)
return i->worldFragment->singleIntersection.y;
return 0;

Sorry for taking up your time, any help you can give me would be great, Thanks


10-11-2007 17:04:57

Note: I split this into it's own thread, since the "Support Info" thread is mainly for discussion about support, not for support itself :)

Anyway, I'm not sure what problems you are having, but the HeightFunction code provided in the examples should work fine with PLSM2. I'm not sure if you know this, but the Wiki article on integrating PagedGeometry with PLSM2 is fairly out of date by now, so the height function code there is much slower than the example height function code (which "properly" raytraces the terrain height only).

Currently I think the only issue remaining with PagedGeometry's integration with PLSM2 is the fact that you can't retrieve the terrain height at a given location until the terrain there has been paged into memory. Since PagedGeometry also pages it's geometry, you will get incorrect results if PagedGemoetry tries to load trees/grass before the terrain under them has been loaded. The solution is to simply make sure PLSM2 loads terrain far enough into the distance that trees don't get placed "outside" of the immediately loaded terrain, and that PLSM2 loads it's terrain on startup before PagedGeometry begins paging trees.


11-11-2007 16:53:05

not to worry i got it :-) working fine