Search Unity

Math problem on Terrain and TerrainData

Discussion in 'Editor & General Support' started by sylvain, Jan 27, 2016.

  1. sylvain

    sylvain

    Joined:
    Feb 19, 2013
    Posts:
    46
    I have some math problems, or comprehension problems on terraindata infos.

    My goal is quite simple : I have to duplicate a terrain to have a smaller version.
    So, I thought it will be simple : recompute the heightmap in a smaller grid, change the size and "voila"...
    But I got a bigger terrain, instead of a smaller one...

    So, the details :
    - terrain1 and terraindata1 are : size=(14230, 500, 14230), heightmapwidth+height=2049, heightmapresolution=2049,
    - I create a new heightmap array of 513x513, computed from the 2049x2049, and create a terraindata2, attached to terrain2; I just write : terrain2.size=terrain1.size (I want to keep the same world/real size)
    - and I get a new terrain, but its size is multiplied by 32 : size is now (455360, 500, 455360,00)

    What are the terraindata properties to set, to correctly shrink my terrain ? I just want to lower the resolution, and keep the original real size.
     
  2. sylvain

    sylvain

    Joined:
    Feb 19, 2013
    Posts:
    46
    Any idea ?
     
  3. sylvain

    sylvain

    Joined:
    Feb 19, 2013
    Posts:
    46
    Ah; I think I have found something.
    Could someone confirm that I need to set "size" AFTER "Setheights" ? It seems that "SetHeights" recomputes "size"...