Hello,
I have a problem with my dynamically generated Terrain.
I want to add details (grass) which I basically do this way:
DetailPrototype detailGrassProto = new DetailPrototype();
detailGrassProto.prototype = Resources.Load("prefabs/AlienGrass") as GameObject;
detailGrassProto.usePrototypeMesh = true;
detailGrassProto.renderMode = DetailRenderMode.Grass;
terrainPrototypes[0] = detailGrassProto;
terrainData.detailPrototypes = terrainPrototypes;
for (var y = 0; y < terrainData.detailHeight; y++) {
for (var x = 0; x < terrainData.detailWidth; x++) {
float height = terrainData.GetHeight(y, x);
if (height > terrainSize.y / 2) {
map[x, y] = 1;
} else {
map[x, y] = 0;
}
}
}
The problem is, the grass seems to be generated at the height of 0. So I always see only half of it through the terrain.
Has anyone an idea how to solve this?
Thanks!
[18062-terrain+details+problem.png|18062]