I have point x,z on tri, need y

Started by
0 comments, last by invective 22 years, 5 months ago
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
Advertisement
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...

This topic is closed to new replies.

Advertisement