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

Procedural terrain bigger than I set it, heightmap slightly off

$
0
0
Hello, I'm about to procedurally create a terrain of the size 120x120. My problem is, the end product turns out to be 480x480 Also the height map isn't set right. That little edge isn't supposed to be there. The height map data is, to my knowledge set right. Here's a Debug.Log: heightMap[0,0] = 0.9363611 That should be the top left corner of the terrain in the attached screenshot. This is how I create the terrain: int chunkSize=120; float[,] heightMap = new float[chunkSize+1,chunkSize+1]; // fill heightMap .... TerrainData terrainData = new TerrainData(); terrainData.size = new Vector3(chunkSize, highest_c, chunkSize); // highest_c is the highest point in my terrain terrainData.heightmapResolution = chunkSize + 1; terrainData.SetHeights(0, 0, heightMap); terrainData.baseMapResolution = chunkSize; GameObject terrainObject = Terrain.CreateTerrainGameObject(terrainData); terrainObject.transform.position = new Vector3(start_x, 0, start_z); Terrain terrain = terrainObject.GetComponent(); terrain.basemapDistance = 100; terrain.castShadows = true; terrain.detailObjectDensity = 0.5f; terrain.detailObjectDistance = 40; terrain.heightmapMaximumLOD = 0; Terrain.activeTerrain.heightmapPixelError = 10; Terrain.activeTerrain.treeBillboardDistance = 100; Terrain.activeTerrain.treeCrossFadeLength = 20; Terrain.activeTerrain.treeDistance = 500; Terrain.activeTerrain.treeMaximumFullLODCount = 200; Does anyone know what's causing this? ![alt text][1] [1]: /storage/temp/19606-heightmapprob.jpg

Viewing all articles
Browse latest Browse all 171066

Trending Articles



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