[Terrain/Texture] Is it possible to change the Terrain just in a certain Area arround the Player?

Hello,
I would like to know if it is possible to change the Terrain just on a certain area around the player f.e. in a radius of 5f. That´s what I have so far ( this works global). I got for each texture 2 variants loaded on the Terrain. They are allways next to each other so I can just give the TextureNumber and add one on it to get the Texture I want to change it to. The position of the Texture from the original should stay the same.

  public void UpdateTerrainTexture(int textureNumberFrom)
    {
        //get current paint mask
        float[, ,] alphas = terrainData.GetAlphamaps(0, 0, terrainData.alphamapWidth, terrainData.alphamapHeight);
        // make sure every grid on the terrain is modified
        for (int i = 0; i < terrainData.alphamapWidth; i++)
        {
            for (int j = 0; j < terrainData.alphamapHeight; j++)
            {
                //for each point of mask do:
                //paint all from old texture to new texture (saving already painted in new texture)
                alphas[i, j, textureNumberFrom+1] = Mathf.Max(alphas[i, j, textureNumberFrom], alphas[i, j, textureNumberFrom+1]);
                //set old texture mask to zero
                alphas[i, j, textureNumberFrom] = 0f;
            }
        }
        // apply the new alpha
        terrainData.SetAlphamaps(0, 0, alphas);
    }

Do you actually want to edit the geometry of the terrain, or just overlay a texture? If the latter, you can just use a Projector.

Okay I managed to change the texture under the player and I can change the texture in one sky direction but just only in that one if I try it to expand it to right, left, back, diagonal it wont work here the code I ve until know:

 public void UpdateTerrainTexture(int textureNumberFrom, Vector3 player)
    {
        TerrainData td = Terrain.activeTerrain.terrainData;

        Vector3 terrainPos = terrain.transform.position;
        float mapX = ((player.x - terrainPos.x) / terrainData.size.x) * terrainData.alphamapWidth;
        float mapZ = ((player.z - terrainPos.z) / terrainData.size.z) * terrainData.alphamapHeight;

        float[, ,] alphas = terrainData.GetAlphamaps((int)mapX, (int)mapZ, 50,50 );

// Paint for 5 fields in one direction
        for (int i = 0; i < 5; i++)
        {
                alphas[0, i, textureNumberFrom+1] = Mathf.Max(alphas[0, i, textureNumberFrom], alphas[0, i, textureNumberFrom+1]);
                alphas[0, i, textureNumberFrom] = 0f;
           
        }




        terrainData.SetAlphamaps((int)mapX, (int)mapZ, alphas);

    }

I tried out a lot of things which should worked from the logic but nothing worked in a good way.

What I get at the moment I uploaded as an webm. What I want to archive is the same thing just in a radius of f.e. 5feet around the players position
Link to WebM(Video)