Question by
Leoo · Oct 01, 2015 at 12:36 PM ·
heightmapterraindataterraintexturesplatmap
[SetAlphaMaps] The Map is not aligned with the SplatAlpha?
Hey guys!,
Something weird is happening to me today, am trying to simply apply 2 different textures to the terrain just checking the distance, no transition needed.
The data am applying seems to be NOT aligned with the actual map? How is this possible?
The only weird way i found to fix the problem is to invert the data.GetHeight(x,y) to (y,x)
Right now i got something like:
splatmapData = new float[data.alphamapWidth, data.alphamapHeight, data.alphamapLayers];
for (int y = 0; y < data.alphamapHeight; y++)
{
for (int x = 0; x < data.alphamapWidth; x++)
{
if(height > 170f){
splatmapData[x, y, 0] = 0;
splatmapData[x, y, 1] = 1;
splatmapData[x, y, 2] = 0;
splatmapData[x, y, 3] = 0;
}else{
splatmapData[x, y, 0] = 1;
splatmapData[x, y, 1] = 0;
splatmapData[x, y, 2] = 0;
splatmapData[x, y, 3] = 0;
}
}
}
data.SetAlphamaps(0, 0, splatmapData);
terrain.terrainData = data;
Thankss!
Comment