I've got a script that makes a terrain object and paints it with textures, but I'm having an issue. When I attempt to place game objects (such as the simple water object that unity provides), I use a Raycast to determine the correct height to place the game object, but that just ensures that it is correctly placed at that particular point.
How would I go about flattening the terrain under the game object so that it doesn't go into the terrain or hang out into thin air in the case of hills?