Archived

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

invective

I have point x,z on tri, need y

Recommended Posts

I have terrain generated from a hieght map, where x,z form the plane, and y is hieght. I would like to be able to determine the hieght (y) of an arbitary point (x,z) on a known triangle, so that I can keep the camera a constant 2 meters over the hieght map, so I can "walk" over my terrain. My initial idea is to subtract 2 points of the triangle from the third to get 2 lines representing the sides of the triangles, then solve the equation of these lines to give me y for my given x,z, and average the results together. Is there a better way to do this? Edited by - invective on November 10, 2001 11:37:01 PM

Share this post


Link to post
Share on other sites
You have to find the intersection of the player''s position i mean the y value with the triangle, so now you have 2 points
the point holding x,y,z and the point holding x,y1,z , y1 is
the value you find intersecting the ray passing trough the player''s position and the triangle you are on, thus you have a straight line so you can find the deltay value an subtract each time to have a constant height, i hope its clear...

Share this post


Link to post
Share on other sites