Moving long mesh on the uneven surface

Yes, I can do the line tracing, but what to do next to bind the mesh to the ground? Can you show an example?