-1

I am making a 3d game where i have to do some terrain generation to have an infinite and random level. The terrain has to be ondular with ups and downs, like this:

https://i.stack.imgur.com/iZl4A.jpg

i used perlin noise to generate a terrain, with multiple planes in a queue, updating them as the player goes forward(i have the Z position of the last plane, so when i update when i peek from the queue the first in line, dequeue it and enqueue it again with new vertices, through mathf.PerlinNoise(0, zPosition)) the reason why i have a 0 in the first parameter is so that the planes are uniform in the x axis

i'd like to have a gameplay similar to dunes but in 3d, where the player controls a ball, clicking while grounded gives it speed, clicking while on air brings it down, and he can get score and streaks by smoothly going through downhills or die if he crashes against an uphill

problem:

https://i.stack.imgur.com/WXg6J.jpg

perlin noise isn't always up and down as i need it to be, sometimes it has those curves in the middle that make the ball jump and have weird not desired movement... appreciate any help on this subject.

1 Answers1

0

I fixed this problem by using the Normal Distribution Function to generate the waves, by messing with the parameters, i can add width or height to my wave Using 5 planes per "wave" (each wave is a gameobject array of 5 planes), and simply going through the vertexes in the x axis, changing all their heights to the same value calculated in the function, incrementing x and doing it again