private Vector3 GetHeightAt(Vector2 _pos, float[] _heights, float[] smoothnesses, int _x, int _z) { float y = StaticMaths.Cap( Mathf.PerlinNoise(_pos.x * granularity + seedOffset.x, _pos.y * granularity + seedOffset.y) * 10f / smoothnesses[_z * tileCountX + _x] + _heights[_z * tileCountX + _x], -tileCountY, tileCountY); float heightStep = mapGenerator.GetDiscreteHeightStep(); if (heightStep != -1) { y = StaticMaths.Discretize(y, heightStep); } return(new Vector3(_pos.x, y, _pos.y)); }
public Vector3 GetHeightAt(float _x, float _z, float _smoothness) { float y = StaticMaths.Cap(Mathf.PerlinNoise(_x * granularity, _z * granularity) * 10f / _smoothness, -heightCap, heightCap); return(new Vector3(_x * spacingX, y, _z * spacingZ)); }