What is the TerrainData.heightmapWidth and how is it different from size.x and TerrainData.heightmapResolution?![]()
I did check the API but that it wasn’t very detailed
Hello,since nobody answered you,i’m gonna give it a shot…I am not very sure,i haven’t tested it,but the difference must be that TerrainData.heightmapWidth returns the width of the image the terrain is made out of (in pixels.For instance if you have a 1024x512 image based terrain,it will return 1024.On the Unity Doc it says that it returns an integer),TerrainData.size will give you the actual size of the GameObject in world units (1 unity world unit = 1 meter…So it will return something like 1001.4216m on the x,226.215m on the y and 4214.241 meters on the z) and finally, TerrainData.heightmapResolution probably is the width of the HeightMap / Height of the HeightMap…So if you have a 1024x512 image the resolution will be 2.As i far as i remember,the Unity’s terrain heightmap has to have its width and height powers of two…So you cannot have a 1024 by 768 heightmap.And that’s why TerrainData.heightmapResolution is an integer too.
This is my guess,again,i haven’t worked with the Unity’s default terrain system too much…
Good luck!
Correct, except that heightmap images must be square and a power of two plus one. So you can’t have 1024x512; instead it would be 513x513 or 1025x1025.
No, it’s the same as heightmapWidth or heightmapHeight (both of which are redundant).
–Eric