terrainData.GetSteepness() usage

How is GetSteepness() used? I just noticed, it accepts an x and y, not an x and z. This is confusing me. What z is used if x and y are given.

Also, I’ve normalized the coordinates based on terrainData.size. For some reason, it returns 1 as the steepness every time, even on sloped hills.

A terrain uses 2D data (namely, a heightmap); there is no Z used in the creation of a terrain. It’s not relevant. Perhaps it would make more sense to specify X and Z, but in this case X and Y refer to the width and length.

When using GetSteepness(), you should provide your X and Z values in place of X and Y, and you should normalize them so that they’re between 0 and 1. If your X and Z values have the same origin as the terrain but need to be normalized, you can use the following:

float normalizedX = myX / terrainData.size.x;
float normalizedY = myZ / terrainData.size.Z;

Now this part isn’t documented anywhere, so this is why I really feel compelled to answer this question: GetSteepness() returns a float between 0.0 and 90.0 representing the Euler angle of the slope. This seemed like a bizarre choice to me - I had expected it to be a float between 0.0 and 1.0.