- Home /
Level of details in a script-made mesh in the sceneview
Hello everyone,
I'm creating a mesh via script that lies above the terrain and is shown in the sceneview in editormode. I put together a lot of these meshes so the whole terrain is covered. The mesh has the same shape as the terrain. I create it while iterating over the size of the terrain (in integer steps) getting the height via terrain.terrainData.getHeight(x,y) and adding the vector (x,height,y) zu my mesh vertices. In our game, when you move, you don't move continuous but you move always a constant distance. So the terrain contains out of "tiles" and the mesh shall show you these tiles. One feature for the time beeing: when you click on one tile it changes color (via manipulating uv coordinats) meaning the player can't stand on this tile.
There are 2 problems: First, when I zoom out of the sceneview (and my terrain gets smaller) some vertices of my mesh "hide" under the terrain resulting in "holes" in my mesh. When I zoom in the vertices get to their right height and the holes are disappearing. Actually, it's not only zooming. Sometimes the part of the mesh in the middle of the sceneview is alright and at the other places there are hole. Moving within the sceneview shows that always the part in the center is fine and the other parts have holes. And than there are those holes, that don't dissapear at all, no matter how close I zoom them in.
Second, the TerrainData methods getinterpolatedHeight, getInterpolatedNormal and getSteepnes always return 0. I tried it over the range from 0 zo 5 in 0.1 steps, it's always zero.
So my questions are: Have scriptmade meshes in the sceneview something like a Level of Detail? Or has anybody an explenation for this beahaviour? And is there any way I could stop these holes to appear? And why are my methods not returning the right values?
For a better understanding I add 2 screenshots (a green terrain and the mesh has a red texture). Thanks for the help.
Zoomed in:
Zoomed out:
Your answer
![](https://koobas.hobune.stream/wayback/20220613080030im_/https://answers.unity.com/themes/thub/images/avi.jpg)