[help] 2 questions regarding terrain height queries

gedimaster

04-10-2005 03:36:12

hi,

i have 2 questions regarding terrain height queries:

a. i'm doing this for the ray - Ray pickRay(dSceneMgr->getSceneNode("myNode")->getPosition(), Vector3::UNIT_Y);

does it mean that even no matter how my object is oriented, the ray is always cast from its position and then vertically down? or is the UNIT_Y wrt to its local axis?


b. i'm using the following to calculate height above terrain:


Vector3 pos = it->worldFragment->singleIntersection;
Vector3 line = pos-dSceneMgr->getSceneNode("acNode")->getPosition();
Real distance = sqrt(line[0]*line[0]+line[1]*line[1]+line[2]*line[2]);


i see that the iterator it has a method it->dist but it always return 0. what value does it represent?

thanks.

tuan kuranes

04-10-2005 07:01:38

a. always down.

b. your distance should rather be something like :
pos-dSceneMgr->getSceneNode("acNode")->getPosition().y - pos.y
(it->dist is a stl iterator internal, no relation with query )