Hi!
I have a 3D-surface that consits of triangles. I want to place a player onto this surface, i.e. I have to count a Z-coord using X and Y coords of triangles. Many advices say I have to cast a ray from the player standing point vertically and thus find a crossing with a triangle plane. But actually that mean check crossing with every triangle forming our 3D-surface, moving from one triangle to another in vertex buffer, cause we don't have access to those triangles through coords - but only through their numbers in a vertex buffer. That way doesn't look very optimal. Optimization looks kinda simple: split surface onto sections, which may be accessed through the coords. But that's only my assumptions.
So, how exectly that problem is usually solved in a modern games? I think there are some standard algorithms.