0
怎樣才能改變陡峭度,就像循環的進度一樣。基本上,我製作了一個頂點的地形,形成一個山谷。爲這些頂點使用的數據的創建在這裏:陡峭度的變化,怎麼辦
// Divides it to a sensible height
const int DIVISOR_NUMBER = 40;
for (int x = 0; x < TerrainWidth; x++)
{
float height = Math.Abs(((float)x - ((float)TerrainWidth/2))/ (float)DIVISOR_NUMBER);
for (int y = 0; y < TerrainHeight; y++)
{
float copyOfHeight = height;
float randomValue = random.Next(0, 3);
copyOfHeight += randomValue/10;
HeightData[x, y] = copyOfHeight;
}
}
這工作正常。但是我現在想要讓第一圈的開始和結束時山谷的邊緣更陡峭,並且谷越接近它所得到的中心。我有一點心理障礙,想不到一個好的做法。任何幫助,將不勝感激。
我猜這個多維數據影響將使它更更明顯? – Bushes 2013-04-26 15:59:51
Cubing會讓山谷變得更平坦,邊緣的曲線更突然。您還需要使用'Math.Abs()'來處理負偏移。 – comingstorm 2013-04-26 16:26:59