UnrealScripterAI
Discord ↗
Link Copied to Clipboard
×
"script for creating a custom terrain"
void UTerrainGenerator::GenerateTerrain(int32 Seed) { // Reset the current terrain data TerrainData.Reset(); // Initialize random number generator with the seed value FMath::SRandInit(Seed); // Generate the height map using fractal noise for (int32 X = 0; X < TerrainWidth; X ) { for (int32 Y = 0; Y < TerrainHeight; Y ) { TerrainData[X][Y] = FMath::RandRange(MinTerrainHeight, MaxTerrainHeight); } } // Update the terrain mesh UpdateTerrainMesh(); }