Hello.
So I am creating my own 3D engine in Gamemaker studio 2.
I am having trouble figuring out the math for how to change an objects position and size depending on it's "z" position.
This is the math I have right now:
scale = z/camera_width
xOffset = (x - (cameraX+cameraWidth/2))*scale
yOffset = (y-cameraY)*scale
xDraw = x*(scale+1)+xOffset
yDraw = y*(scale+1)+yOffset
xScale = scale+1
yScale = scale+1
(xDraw / yDraw is where to draw the object and xScale / yScale is the size of the object)
This is the video showing how it doesn't work:
What I basically need is a way to turn X,Y,Z variables in to X,Y and Size variables.
If you know the formula in order to make that work it would be greatly appreciated.
Thanks.