i would like to measure the size of the terrain i’ve created…
how do i actually use the code?
var terrainData : TerrainData;
var heightmapWidth : int;
function Update()
{
var viewPos = camera.WorldToViewportPoint( target.position);
if(viewPos.x < TerrainData.heightmapWidth)
{
bla bla bla...
}
}
but there is an error : an instance type ‘UnityEngine.TerrainData’ is requried to access non stactic member ‘heightmapWidth’
hope there is someone that can help me =)
Thank you so much =)
Watch the capitalization…your variable is called terrainData but you’re referring to TerrainData in your code, which is a different thing. Also, heightmapWidth is the width of the heightmap in samples and doesn’t have anything to do with physical size. You want to use .size for that.