I'm trying to make a 3D terrain generator. In doing so, I decided that I would use basic rectangles and then just turn them by having 4 points, 1 on each side, then turn the rectangle to fit in those points. Now when I try to make it so that it can decide a new point, with the distance being the length of the new rectangle ( which all rectangles are congruent so it'll stay the same ) and the slope of the 2D line between the bricks will be a randomly picked number (
Math.random()*3-3 ) so I tried to solve it like this
then came out like this
then find the y-intercept
then I would plug in X to the 2D equation of a line
yet for some reason all the rectangles would come out facing either 90 or 180 degree angles. Did I do my math wrong or is it some other error I made?