Thursday, October 20, 2016

orientation - X, Y, Z coordinate standards?


I'm pretty new to 3D development of any kind, nonetheless games. As I read through tutorials and examples, I find that the X/Y/Z coordinates seem a bit backwards than my first guess.


I had imagined that if a person were walking around a field, their X/Y position would be changing and if they were to jump or walk up or down a hill, then their Z position would be changing. My assumptions appear to be wrong because walking around a field seems to change X/Z and jumping or going up/down a hill alters the Y.


1) Are my observations correct? 3D is new to me and I may not be thinking about things properly.


2) What's the logic behind horizontal movement being X/Z and vertical movement being Y?



3) Would it be so wrong of me to use X/Y as horizontal movement and Z as vertical movement in the XNA Framework?



Answer



Your assumptions aren't wrong: each engine treats these coordinates differently. Generally speaking X is almost always the East-West axis but whether Y or Z is the Altitude axis tends to vary. As I understand it, Quake 3, the Source Engine, and the Torque engine all have Z as up. So does the modelling tool 3DS Max. It's not uncommon.


It makes sense to have a coordinate system that is ordered roughly in descending order of importance, so that flattening a representation into fewer dimensions is easier to understand. For example, if your game is set on a 2D height map, it makes sense for Z to be 'up', because then your X and Y coordinates in the 3D world map directly to the X and Y coordinates on the height map. On the other hand, if you think primarily in terms of rendering (and many game engine developers do), you're used to X and Y being the screen coordinates, so adding a 3rd axis naturally goes in or out of the screen.


Use what is easiest for you, but be aware that any choice is arbitrary and that you may need to convert between them and use multiple coordinate systems within one program.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...