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
Calculating Hieight Map
1 reply to this topic
Members - Reputation: 122
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.