Determine whether a point is below terrain or not

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
hkolli
Posts: 42
Joined: Thu Jul 13, 2006 8:29 pm

Determine whether a point is below terrain or not

Post 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 :(
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

I think you should check for xyz > minxyz and xyz < maxxyz !?!?!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post 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.
stodge
Posts: 216
Joined: Fri Dec 05, 2003 5:57 pm

Post 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.
Post Reply