I learned at school that the z-axis is up. It is the same in modeling software like Blender. However in many games the y-axis is up.
What is the reason?
I learned at school that the z-axis is up. It is the same in modeling software like Blender. However in many games the y-axis is up.
What is the reason?
I think the direction of the coordinate axes are holdovers from different domains where the crucial plane was different, and X/Y were aligned with that crucial plane. In some applications the ground plane was the most important, thus X/Y were the ground and Z ended up perpendicular to that. For games however the crucial plane is usually the screen (especially of course back when they were 2D and just starting to transition to 3D) thus X/Y were the screen and then when games went 3D Z ended up perpendicular to that.
You can see that kind of distinction between the two biggest 3D art tools: 3ds max and Maya. The Z axis is up in 3ds max because that grew out of architectural tools, while the Y axis is up in Maya because that grew out of movie-making tools.
The important thing to realize when comparing any specific tool to what you learned in school is that it's all arbitrary. It really doesn't matter which way the axes are pointed as long as you keep everything consistent and translate correctly between different coordinate systems.
EDIT: relevant tweet from Tim Sweeney lol https://twitter.com/timsweeneyepic/status/952661474501111808
As far as I have ever gleaned the Y = up/down, and Z = depth is based off of physics where gravity is always in the (-Y) direction, and then adding 3D means you don't want to change a fundamental, so it was made depth.
On the Z = up/down method though that is a throw back to mathematicians. because X/Y was drawn on the paper that was flat on the table when the Z-axis was extended it was coming up out of the paper, and therefore up. though many of your engineers will also use this convention as well.
in regards to the convention used by the given tool: Maya, and Unity have Y-up (probably designed by someone with a physics background). while 3DsMax, and Unreal have Z-up (probably designed by mathematicians/engineers). though it can also be said that these could also be just a split decision made one day because a consistent system had to be used.
since this question focuses on a modelling tool, and is placed on a gamedevelopment Q&A site. you might want to look into what coordinate system you will be exporting to, and make sure that you conform to that.
also realize that some system the axis system is hard set, and permanent, and others it can be modified (think it can be changed in Blender and Unreal, but might be mistaken)
It's mostly legacy from the times when all that could've been made with 3D was some screen-space rotating cube or parallax scrolling or something similar. In such applications, Z was "depth" because X and Y were the axes for the screen plane. As demos were getting more advanced, the original conventions stayed because it's easier not to change anything that works.
As for why exactly today's games have Y as the vertical axis - there are lots of poorly written tutorials out there that do not explain the difference. Usually it's most useful to have the primary movement plane on X and Y axes (so that most 2D calculations don't require swapping axes in code). For most sidescrollers, it is quite naturally coincident to the screen plane (X/Y). For adventure games and such, X/Y works nice as the horizontal plane (perpendicular to direction of gravity) because it maps perfectly to in-game maps, gamepad controls, terrain heightmaps and many other things.
Because the coordinate system that are used in games are based off of the dimension of the monitor. When computer renders anything, it starts at the upper left hand corner which gives the x, and y coordinate of [ 0, 0 ]. As the rendering progresses towards the right side of the screen, the x value increments, respectively when the render moves down, the y value increments. The coordinate system is basically that of a 2D space, except the origin rest on the upper left hand corner and not the center of your screen.
In 3D packages such as 3DsMax and Maya, they have their own definition of x and y coordinates based on what is is important to them. 3DsMax was based off architectural design, if you draw a schematic on a 2D plane, y is up. In Maya, which is mainly use for animation therefore the ground is x, y and the height is z.
in all truth Frankie Law and snake4 gave the correct answer together if you think about it. The monitor itself is already in the xz plane not the xy plane. However, 2d started programming it all as xy, even though the correct direction would have been xz, unless your monitor is sitting flat on the ground, facing up, and your looking straight down at it, from directly above it. In which case it would be correct.
to clarify for those who need it: xyz has existed in physics and math longer than 3d graphics. And as 2d graphics started they only used two dimensions with no intention of adding a third at that time, so x and y. By the time a third dimension was added, simply adding it as the missing dimension was easier than rewriting years of work to put x, y, and z in their proper perspectives. So now we have two definitions that will never agree: on the one hand z is depth, or distance forward/backword, on the other z is altitude or up/down.
To complicate it even more for game development, before 3d graphics, in "top-down" games it was still x and y on the screen where y was not used as up, in 2d by "side scrollers" it was still x and y and here y was clearly used as up. So for game development which is height or depth depends on perspective.