TerrainData.SetHeightsDelayLOD Not actual height option?

Hello guys, im trying to apply realtime terrain deformation based on the players position.
i found out you can do this by using TerrainData.SetHeightsDelayLOD, As the Reference tells

public void SetHeightsDelayLOD(int xBase, int yBase, float[,] heights);

xBase = int pixels of the x position in Hightmap
yBase = int pixels of the y position in Hightmap
heights = Float [int,int] each int represent how many pixels of the area around xbase and ybase its gonna get deformed. But the script reference tells us, heights = Array of heightmap samples to set (values range from 0 to 1, array indexed as [y,x]). You can’t set anything between 0 and 1 since its an integer and as i said above its in pixels instead and its just the area around the xbase and ybase, so theres no possible way to set actual height is it? is that a bug?

Sample image Unity Deformation - Album on Imgur
1 is basicly the height set to float[6,6]
2 is [1,1]

I’m not sure I fully understand your question.

But to clarify heights, look in your Terrain object in the inspector, look under the gear (Terrain Settings) and find the “Terrain Height:” entry.

“Terrain Height” is what the values in Heights[,] are scaled to, from 0.0f to 1.0f, scaled up to the “Terrain Height” value in local vertical terrain space.

Thank you for anwsering! But why theres two values in Heights[,]?

That is a two-dimensional array of float numbers, indexed by the “across and down” of each terrain cell.

I see, but check the picture i posted.

The picture looks like a grooved terrain.

Again, I don’t understand your question.

If you want some sample operating code to transact against the Unity TerrainData heightmap stuff, you can check out my MakeGeo repository. It has a terrain ramp cutter, and a “make terrain from perlin noise” area too.

MakeGeo is presently hosted at these locations:

https://bitbucket.org/kurtdekker/makegeo

Yes i dont understand why the terrain gets grooved, instead of having specific height, im having a specific width in Heights[,]

In nutshell the terrain gets grooved wider instead of deeper.

This is what I don’t understand. Are you only putting 0 or 1 in the terrain heightmap? Why? It is a floating point value.

The terrain height is 15 from the inspector, in code if you try to new float[0.2f,0.5f] for example you get “Cannot implicitly convert type ‘float’ to ‘int’. An explicit conversion exists (are you missing a cast?)”

float[,] Height = new float[1,1];
        Height[1,1] = 0.1f;

IndexOutOfRangeException: Index was outside the bounds of the array.

Im propably don’t understanding the syndax here.

You’re cross-conflating two unrelated ideas here: the notion of what is actually stored inside a single entry (or cell) in a float[,] array (which is a two-dimensional array), and how you index it, which is by two integer coordinates supplied inside of square brackets, the across and the down if you will.

Think of the heightmap like a spreadsheet: each cell has a floating point number in it. Each cell is indexed by a column number and a row number.

The floating point number from 0 to 1 inside each cell will tell you from 0 to TerrainHeight how high that area of the ground is.

If an array is only of dimension [1,1] then it only has a single cell in it indexed by [0,0]

All array indices are zero-based.

If it is of dimension [6,6] then it has 36 cells in it, ranging from [0,0] to [5,5]

Give me an example of having 10 terrain height and wanting to groove only from the half and above. e.g from 5 to 10.

Yeah i kinda start to understand it, how do i asign the height tho. i dont understand the sindax

if its heights[1,1]

heights[0,0] = 0.1f

is that correct?