I have a plane geometry and I want to draw line between two points
but I want to make it "laying" on mesh like this
How can I find appropriate triangles and calculate Y for line point?
I have a plane geometry and I want to draw line between two points
but I want to make it "laying" on mesh like this
How can I find appropriate triangles and calculate Y for line point?
Depends on what you want the line to do. If you want to draw the shortest path between two points, that's a very complicated problem - google "shortest path on mesh".
If you want a 2D line projected vertically onto the mesh, that's much easier to do. It is not the same as a shortest path. Think of a tall mountain - shortest path between two points on its base probably goes around the mountain, instead of over it.
Assuming you simply mutated the points on your plane geometry with your height data, you would have to trace a line between your two points, figure out which 2D triangles it crosses, and split the line accordingly. It's pretty straightforward but will take a good bit of code to get right.