Page 1 of 1

Determine whether a point is below terrain or not

Posted: Wed Jul 26, 2006 6:54 pm
by hkolli
Hi all

in my project after the terrain is loaded i need to know whether a point is below the landscape for this i wrote like this ---

the point in 3d space is offset

Box1=terrain->getBoundingBox();
if(offset.x<Box1.T minxx || offset.y< Box1.T miny || offset.z < Box1.T minz)

flag = true ;

else
flag = false ;

---------------------------------------------------------------------------'

is it right to do to know whether the point is below the terrain or not

please help :(

Posted: Wed Jul 26, 2006 8:35 pm
by Acki
I think you should check for xyz > minxyz and xyz < maxxyz !?!?!

Posted: Thu Jul 27, 2006 5:14 am
by Dances
Or if your terrain height differs in different positions draw a line either straight up or straight down and check for a collision. I believe the collision tutorial explains exactly how to do this.

Posted: Thu Jul 27, 2006 11:48 am
by stodge
Dances wrote:Or if your terrain height differs in different positions draw a line either straight up or straight down and check for a collision. I believe the collision tutorial explains exactly how to do this.
Agreed - cast a ray straight up and check for collisions against the terrain.