Hi.
I want to make a function in API to teleport player on location (x,z), let say function teleport_to_surface(x,z). For this i need to calculate a safe Y value so player don't teleport underground or on high and fall to death. So require is to teleport on ground on terrain or if is any building block here, on top of it.
Any can have a idea to accomplish that?
First try was to use function raycastFromWorldPosition(...) but this have serious limitless like chunk when i want to teleport need to be rendered on client side and if teleport far away or on unexplored world .. this approach do not function.
For second try i think to read somehow position of Z direct from chunk data, but here i am stuck i don't have idea how i can do that. Moreover what happen if i want to work with a chunk which was not yet generated by server ...
Thx in advance for hints!