Make sampleTerrain work for mesh terrain.