Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Terrain.SetNeighbors causes black lines [Unityscript]

$
0
0
I am using Terrain.SetNeighbors in my code to connect different chunks I am creating using a perlin function of mine. However, whenever I use Terrain.SetNeighbors, I get black shadows in between all of the Terrains. Isn't this meant to stop this? Here is my code: function AddChunksToNeighbor() { var Up : Terrain; var Down : Terrain; var Left : Terrain; var Right : Terrain; if(StandardVars.Chunks.ContainsKey(Vector2(ChunkOrigin.x, ChunkOrigin.y + 1))) Up = StandardVars.Chunks[Vector2(ChunkOrigin.x, ChunkOrigin.y + 1)].ChunkObject.GetComponentInChildren(Terrain); if(StandardVars.Chunks.ContainsKey(Vector2(ChunkOrigin.x, ChunkOrigin.y - 1))) Down = StandardVars.Chunks[Vector2(ChunkOrigin.x, ChunkOrigin.y - 1)].ChunkObject.GetComponentInChildren(Terrain); if(StandardVars.Chunks.ContainsKey(Vector2(ChunkOrigin.x - 1, ChunkOrigin.y))) Left = StandardVars.Chunks[Vector2(ChunkOrigin.x - 1, ChunkOrigin.y)].ChunkObject.GetComponentInChildren(Terrain); if(StandardVars.Chunks.ContainsKey(Vector2(ChunkOrigin.x + 1, ChunkOrigin.y))) Right = StandardVars.Chunks[Vector2(ChunkOrigin.x + 1, ChunkOrigin.y)].ChunkObject.GetComponentInChildren(Terrain); terrain.SetNeighbors(Up, Down, Left, Right); terrain.Flush(); } Here is what my terrain looks like without: ![alt text][1] And here is what it looks with the terrain.SetNeighbors(Up, Down, Left, Right); line: ![alt text][2] I know that all of the code should work, and that the Left, Right, Up, Down variables are the X-, X+. Z- and Z+ terrains. Any help is greatly appreciated, cheers. [1]: /storage/temp/14795-screenshot+(29).png [2]: /storage/temp/14796-screenshot+(30).png

Viewing all articles
Browse latest Browse all 171066


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>