• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Calculating Hieight Map

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

1 reply to this topic

### #1rgirard413  Members

Posted 17 June 2001 - 04:32 PM

OK, here is my problem. I''m writing an OpenGL engine that will load in a map file(custom made) with many triangles and there textures coords and what not. Anyway, the triangles can be any size. I was goin to test the three points and bla bla to get the hieght of the camera from them, but seeing that the poly''s can be any size, this will not work because i cant tell what poly im in. Also the poly''s may not be organized from point 0,y,0. Is there either 1.) A way to determine what triangle im currently in? 2.) A fast and decent way of dropping a ray to test how high i am in relation to the ground? 3.) Creating a hieghtmap based on the mapfile? Thanks for any help. Randy

### #2Zaei  Members

Posted 18 June 2001 - 05:29 PM

YOu can loop through each triangle in your map, and shoot a ray from n height above the map to n height below. Create a plane from the three points that define the triangle you are testing, and see if you get an intersection (which you should), and save the result. If so, use a Line-Triangle Intersection test on the three points. If the line does intersect the triangle, and you dont have any over hanging surfaces, return the saved intersection point.

Z.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.