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
sizeOfRectangle=(X-oldPoint.X)*new_slope
then came out like this
X=sizeOfRectangle/new_slope+oldPoint.X
then find the y-intercept
B=oldPoint.Y-(new_slope*oldPoint.X)
then I would plug in X to the 2D equation of a line
Y=new_slope*X+B
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?