Hey there,
I’m stuck on this part for a long time now, and couldn’t find a proper answer online. So I come to you guys in the hope someone can help me with this.
Situation:
I want to place terrain details (grass, etc.) on the terrain in runtime.
Problem:
The placing terrain details on the terrain part worked. The only problem is that I cant properly translate the values I put into the SetDetailLayer() function.
Example code:
for(i = 0; i < 7; i++){
var test2 : int[,] = new int[2,2];
test2[0,0] = 10;
test2[0,1] = 10;
test2[1,0] = 10;
test2[1,1] = 10;
terrainDA.SetDetailLayer (i*2, i*2, 0, test2);
}
Example picture:
With the example code, and cubes with a size of (4,1,4) generated on the following positions; [(2,2), (6,6), (10,10), (14,14), …], I get you can see in the example picture below.
As you can see I can place the grass, but It isn’t placed where I want it to be. It’s just a bit off, but on a large terrain that can be crucial. Does anybody know where I went wrong?
Thanks for reading!
And yes, I know the dangers of using non supported functions.
Sources:
SetDetailLayer
