예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        terr                = Terrain.activeTerrain;
        textureHeights      = new float[Map1.width, Map1.height];
        othertextureHeights = new float[Map1.width, Map1.height];
        for (int i = 0; i < Map1.width; i++)
        {
            for (int j = 0; j < Map1.height; j++)
            {
                textureHeights[i, j]      = Map1.GetPixel(i, j).r;
                othertextureHeights[i, j] = Map2.GetPixel(i, j).r;
            }
        }

        heights = terr.terrainData.GetHeights(0, 0, 1 * terr.terrainData.heightmapWidth, 1 * terr.terrainData.heightmapHeight);
        GenerateATerrain();
        alphaMaps = terr.terrainData.GetAlphamaps(0, 0, terr.terrainData.alphamapWidth, terr.terrainData.alphamapHeight);
        PaintATerrain();
    }