Get height value at specific x and y coordinate via script It may be simple but I don't get it to work. I have ground objects and several other objects that should stand on the ground. These other objects are automatically positioned. The x,y coordinates are fixed here, but the z coordinate has to be adapted so that the objects really stand on the ground.
What is the best option here? Use object.ray_cast or search for nearest vertices in the area of x,y?
Precisely speaking you need some sort of collision detection look at this book and this link for more info.
Roughly speaking ray casting  is a good way; but be careful about optimization.I suggest you to compare x-y bounding boxes of your objects and groundObjects (using bpy.data.objects['Cube'].bound_box
). If they overlap each other do raycasting for each vertex of your objects on the overlapping groundObjects and choose the shortest one.