first commit

This commit is contained in:
2026-08-28 16:09:06 +01:00
commit 04047ddf57
12824 changed files with 3833852 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
using UnityEngine;
[ExecuteAlways]
public class HeightmapAssigner : MonoBehaviour
{
public Terrain targetTerrain;
public Material targetMaterial;
void Update()
{
if (targetTerrain == null || targetMaterial == null) return;
// Get the heightmap texture from the terrain
Texture heightmap = targetTerrain.terrainData.heightmapTexture;
// Pass the data to the shader
targetMaterial.SetTexture("_TerrainHeightMap", heightmap);
targetMaterial.SetVector("_TerrainPos", targetTerrain.transform.position);
targetMaterial.SetVector("_TerrainSize", targetTerrain.terrainData.size);
}
}