#### Archived

This topic is now archived and is closed to further replies.

# Calculating Hieight Map

This topic is 6061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
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.

##### Share on other sites
Hidden
[quote name='rgirard413' timestamp='992817170' post='51503']
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 either1.) 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
[/quote]

Are you loading in a terrain map to a single large mesh, or a complete level with terrain, buildings etc. too?