Hi, I've been working on a procedural terrain generator for a little while and it's coming along nicely. I'm at the point where I'd like to spawn grass patches across the land, but I'm struggling with the logic.
The terrain is a flat surface made up of several bumpy squares combined in an ArrayMesh. I'm looking for a method that can check if the random space I'd like to spawn something in on is flat ground. I'd check the given x and z coordinates and see if the y value of my mesh is 0.
I watched this tutorial ( ) and it seems like it would accomplish what I'm looking for. There's one problem, though, and that's that to pass the height information to his shader, he supplies the height map that made his terrain. I'm not sure how I'd get the height data of my ArrayMesh to be understood by a shader, or any object wanting to understand if there is ground beneath where it's spawning. I'm pretty new to 3D, so any suggestions are greatly appreciated!