Ray Query On Terrain Returning Zero

eduffield

05-08-2006 17:53:37

Hello,

I have converted my application to the paging landscape by taking chunks of code from the example. My ray queries do not work any longer. They used to work in my older application.

Simply, they go randomly over the map and get the height of each area and plant a tree. Then every time it returns 0 for the height.

Any ideas what might have caused this?

Is there some code that if I had missed it, it would break ray queries ?

I dont think its the actual ray query code because I have tried about 50 different ways of doing it to no avail.


I just updated my plugin for the paging a moment ago to the CVS.




Ray pickRay;
RaySceneQuery *rayQuery = mSceneMgr->createRayQuery (pickRay);

pickRay.setOrigin (Vector3(x, 32000, z)); // tried 0, -32000
pickRay.setDirection(Vector3::NEGATIVE_UNIT_Y); //tried UNIT_Y
//raySceneQuery->setRay(updateRay);
rayQuery->setRay (pickRay);
rayQuery->setQueryMask (RSQ_FirstTerrain); //also tried RSQ_Height, and nothing at all
rayQuery->execute ();
RaySceneQueryResult& result = rayQuery->execute();
RaySceneQueryResult::iterator i = result.begin();
if (i != result.end() && i->worldFragment)
{
return i->worldFragment->singleIntersection.y;
}

Falagard

07-08-2006 20:20:01

It looks fine to me. What are your x and z values?