Exemplo n.º 1
0
    public void SmoothTerrain(Vector3 pos, int size)
    {
        int     offset          = 0;
        Vector4 terrainPosition = GetTerrainPosition(pos - terrain.transform.position, size, out offset);

        float[,] heights = terrain.terrainData.GetHeights((int)terrainPosition.x, (int)terrainPosition.y, (int)terrainPosition.w, (int)terrainPosition.z);

        heights = terrainToolkit.Smooth(heights, (int)size);
        terrain.terrainData.SetHeights((int)terrainPosition.x, (int)terrainPosition.y, heights);
    }