Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Z should be up

Discussion in 'General Discussion' started by CaoMengde777, Mar 7, 2015.

Thread Status:
Not open for further replies.
  1. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Haha yes, if we go way back first drawings were on caves walls, so Y was up back then i guess XD
     
    Tomnnn and GibTreaty like this.
  2. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    No idea, I would have just some how made a converter that would read it upon importing model. Like really change the axis or anything, but change the pivots to the right position to work in Unity properly so if you forget about it like I know I do sometimes, it would correct it lol.
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    To solve this whole thing, I'm renaming the axes to "Q", "Wibble", and "Dave". Q points to the right (except on Tuesdays), Wibble points whichever way is most convenient, and Dave points to the nearest decent pizza joint. This will cause a revolution in 3D design, and might make CaoMengde777 less grumpy.

    --Eric
     
  4. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    first drawings were most likely on sand... ... like the symbol of crosses is from NESW, the sun
    ... or some book i read recently claims..
     
  5. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Lol it doesn't matter, even sand is not flat and depends where you are in the world your flat piece of paper never point in the same direction since the world is not flat (or that's another lie from school ?)

    People are trying to tell you nicely that's the problem is only in your head XD
     
  6. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860


    Why not dive deeper into this psychosis?

    Cartesian coordinates were invented by a French mathematician René Descartes
    back in 1637. So yes, they predate white boards. Black boards go back a little further, first used in schooling around 1793. But still not pre Cartesian. Paper drops back to around 12- something (in France). So its plausible to think Descartes might would have been using paper. But what's interesting is that paper was not traditionally used on the flat desk of the modern class room. Any draughtsman that still uses paper will tell you that an angle of 30-45 degrees is often more ideal. For larger works you get closer to vertical. The easel and similar devices have been in use since as far back as 4000 BC.

    Anyway back to the Netherlands (Descartes was considered a heretic in France). Descartes invented our modern system of x, y and z for unknowns, and a, b and c for knowns. This raises the question, which one did he consider to represent the vertical? This leads me to brushing off my French and reading La Géométrie.

    And back. Sorry about the wait, my French is rusty. Turns out La Géométrie only doesn't explicitly define the Cartesian system, through the idea is present through the text. All of the recent analyses of the text describe x as being horizontal, and y as being vertical. The concept of depth isn't mentioned in these analyses. While Descartes opened the to allow multi dimensional mathematics it doesn't appear he actually considered them in depth.

    And that enough reading for tonight. I considered going on to Philosophiæ Naturalis Principia Mathematica. But Latin is more useless to me in my day job then French. So yeah, stick to your guns. But remember, the "I think, therefore I am" guy says you are wrong.

    :)
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    You do NOT disagree with the "I think, therefore I am" guy. Because if you do, he says, "I'm thinking about punching your lights out, therefore I am doing it." Then you end up flat on the floor (X/Z plane).

    --Eric
     
    Kiwasi likes this.
  8. Pix10

    Pix10

    Joined:
    Jul 21, 2012
    Posts:
    850
    More commonly known as the Beer System.
     
    the_motionblur and DennG like this.
  9. kdubnz

    kdubnz

    Joined:
    Apr 19, 2014
    Posts:
    177
    I come from an AutoCAD (and Maya) background where X and Y are plan Axis and positive Z is UP.

    (has dogs and old tricks been mentioned)

     
  10. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    I'm pretty sure Maya has Y as up like in Unity.
     
    GibTreaty likes this.
  11. Pix10

    Pix10

    Joined:
    Jul 21, 2012
    Posts:
    850
    Quite a few applications do, and most also let you set what you want as Up - I suspect this is more for cross-application compatibility than familiarity though. Of all the things you can change over time, the worst thing in the world for any 3D application would be to one day force a change of it's native Up. It would be the ruin of a great many nervous systems.
     
  12. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,381
    Thats it, someone hack the dll's to sort this madness out.
     
  13. kdubnz

    kdubnz

    Joined:
    Apr 19, 2014
    Posts:
    177
    In Maya Z is switchable.
    I used it Z up , same as AutoCAD, 3dMax, Blender, Unreal Engine ...
    Plan is X,Y
    ... throw it on the ground and Z is up.


    I should have been more explicit.
     
  14. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    I hate z as up doesnt make sense.
     
  15. Brainswitch

    Brainswitch

    Joined:
    Apr 24, 2013
    Posts:
    270
    There is nothing preventing you from using Z as 'up'. Just change the Gravity to be negative Z instead of negative Y. Sure, it might be confusing to call transform.forward instead of transform.up, but hey, you can create a few extensions to the Transform class or something. Alternatively you could just try to bite the bullet (and not chew through a few magazines to switch Y and Z in Unity) and accept that X,Y & Z should really be called Q, Wibble and Dave. It's the only reasonable way to do things.
     
  16. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    That would also help students and developers remember what axis does what. This is often a test question in some of the game dev courses at my school.

    Oh hey look it's that point I made a few hours ago.

    x,y relative to the surface. Paper on the ground? Z comes out at you, which is upwards. Relative to the paper surface, z is forward and back (depth) and y is up.

    Again, consider the orientation and feelings of the paper, you monsters!

    I'm genuinely confused that z was ever regarded as up. To use z as up, you have to look down at the paper, making your relative y for the surface you're looking at up as well... unless you use paper by sitting even with the surface it is resting on, staring at the thin edge, z cannot be up lol.
     
  17. SeriousM

    SeriousM

    Joined:
    Sep 24, 2014
    Posts:
    8
    It's against natural thinking if z is not up.
    Do you jump 1 feet up or do you jump -1 feet up?
     
  18. Brainswitch

    Brainswitch

    Joined:
    Apr 24, 2013
    Posts:
    270
    It's against natural thinking to use the imperial system :p
     
    Ostwind likes this.
  19. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    This so reminds me of the XNA days... when everyone whined and complained about 3DS Max because it was Z up... and XNA was Y up. Can't remember if it was LH or RH... I think it was LH though as I'm pretty sure positive X was to the right...

    At any rate... maybe you should go complain in the Autodesk forums that they don't have an option to make Y up like the vast majority of other modeling / animation applications. :p

    Also, as for Blender, unless they broke it again, the newer FBX exporter allows you to specify the directional axis when exporting and it will import into Unity with the correct orientation (and not have to use the -90 hack).
     
  20. SeriousM

    SeriousM

    Joined:
    Sep 24, 2014
    Posts:
    8
    haha, actually I'm used to the metric one but thought it's easier to make my point because it's a bigger american community ;)
     
  21. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Except in Cartesian coordinates (3d), z is up. At least according to the most reliable webpage on the internet (Wikipedia) ;)
     
    leoblue2002 likes this.
  22. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Technically the force normal would be -1 lol

    Kind of counter unexpected, no? In america, bigger is better for EVERYTHING... except our measurements. If we switch to metrics, everything we care about measuring grows x2.54!

    Except to consider Z up, your plane's x and y need to be resting flat on a surface. It's not really useful to look at a surface that way, because then you can only see 1 dimension of it. To see x and y, you need to be facing opposite the plane's normal. When you do this, x is relatively right, y is relatively up, z is relatively the depth of the plane.
     
  23. Pix10

    Pix10

    Joined:
    Jul 21, 2012
    Posts:
    850
    Max is a mess. World up is Z yet object transform gizmos show Y as up when in orthographic (left/top/front) views unless you specify local as the transform. Confuses many a newcomer. Good drugs at AD apparently.
     
    Dustin-Horne likes this.
  24. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    It should be editable in prefs, this might be added in Unity17
     
  25. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    You do understand what this would cost performance wise right? Right or wrong, lets pick a convention and stick with it. We really don't want to be adjusting for user preferences inside of a component as fundamental as Transform.

    And lets not talk about work flow. Building every script you write to function with both y up and z up? The thought gives me nightmares.
     
  26. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    Each users writes it as it likes, then when building all goes uniform, 0 overhead during playtime. To ease things there could be a variable at top of script that defines what up is considered Z or Y and a default of Y when nothing defined. No more nightmares.

    Edit, I also come from Engineering world. Microstation and this kind of blabla stuff.
     
  27. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    No, that's definitely nightmarish. Way too much potential for breakage and confusion, and far too little benefit.

    --Eric
     
  28. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Good job this is never changing. So less moaning and more work on your games please chaps n chapettes.
     
    Kiwasi likes this.
  29. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Code (CSharp):
    1. #pragma YasZ
    I'm seeing the flood on answers already "Why is my box moving sideways when I tell it to move up?".

    Combining scripts also becomes difficult.

    In general you'll have no idea if any given Vector3 will be used as (x,y,z) or (x,z,y). That kind of indeterminate behaviour breaks programing.
     
    Dustin-Horne likes this.
  30. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    hey ok.>> There are so many other things waiting a real fix in unity that I would so easily leave the "y" stuff in there, I'm almost ussed to it. But this is an ankward convention.
     
  31. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Yep, you would be able to code how you want and go happily along treating 'Z' as up but then you start pulling in third party assets and everything would break.

    Exactly why coding with JavaScript sucks when building web applications. A plugin comes in and redefines the meaning of something as simple as 'undefined' or 'window' or even a built in function like alert and it causes unexpected behavior.
     
  32. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    I should just mention my side of it. I was using Blender with Z-up before using Unity. It didn't really give me any problems at all. It is a simple logic problem to consider. Remember that everything is relative anyway. Each object has it's own coordinate system, and that applies in Blender, Unity, and everything else too. You can even do modelling/editing based on either global or local coordinates/axes. So understanding this fact, which is something you kind of learn as you are learning anything about 3d, maths, etc... then it shouldn't be too difficult to understand that not only is Unity different from some software, and the fact that we have to get used to different systems is basically a fact of life, you just deal with it and move on.

    I should also mention about the egypt-style curly braces(saw comments on first page). I hate that as I've always been used to the other way with the braces all of the left, as in my opinion most people I know are, coming from C/C++ background. In any case, it is an easy fix, but you can't blame mono-develop. Unity has a set of template files it uses that define this behavior. It loads then template, replacing certain text with your new class name, and the one for C# has the egypt-style braces. It is a simple fix, as you can quickly open the file, change it, and save it, and Unity will use it. The catch is that since it is in a reserved spot(program files) you need admin access so you need to open your text editor as an administrator. I'm not sure of the rules on Mac for this.

    This technique also allows you to get rid of the errors about line endings with some being windows and some being Mac. I think that the templates are coming in Mac line endings, and then as you modify the files in Mono-Develop or VS, it adds windows line endings, making you get mixed line ending errors. So you then have to force the text editor to redo the line endings in order to get rid of the warnings. But if you do this on your original template like I do, you never have to mess with it again.

    Last thing, it allows you to put whatever else you want there too. So if you always use the physics Fixed Update, you can add it. If you tend to forget the event functions often, you can add them here and delete later the ones you don't want. You can add comments to separate sections for public and private variables, and whatever else you want to add to the files, like includes/pragma comments, whatever.

    On my computer, the install puts those files here.
    Code (csharp):
    1.  
    2. C:\Program Files\Unity\Editor\Data\Resources\ScriptTemplates
    3.  
    It is probably in a similar path on other systems, and the path should be the same in any case once you get the right Unity directly, for example if you are using 32-bit Unity(or any version before 5.0), it will be in Program Files(x86) instead. Just remember to open the text editor as Administrator or it won't let you save the file in most windows versions.
     
    Kiwasi likes this.
  33. Mwsc

    Mwsc

    Joined:
    Aug 26, 2012
    Posts:
    189
    This discussion is way too complicated and generally missing the point.
    We are talking about Unity, which uses XYZ coordinates in the context of computer graphics.
    Graph paper, whiteboards, engineering, photography, none of that is relevant in the least.
    In every computer graphics textbook ever written, X is the horizontal image axis, and Y the vertical.
    This is because XYZ are the cartesian dimensions, and computer graphics originated in 2D, so just X and Y were used.
    Why on earth would Z be height when we haven't even used X and Y yet?
    Later, when 3D was invented, the only possible choice for depth was Z.

    Don't believe me? For a rate of $500 an hour I will gladly come up with citations for every computer graphics book ever written.
     
    Kiwasi likes this.
  34. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    Using a convention founded on 2d for representing 3d looks no good. No matter how deeply arranged is in the gaming history. International conventions in coordinates use z as up. UTM WGS84 etc
     
    leoblue2002 likes this.
  35. Jonny-Roy

    Jonny-Roy

    Joined:
    May 29, 2013
    Posts:
    666
    I'm older than you.
     
  36. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    How is a mapping system for locations on the earth relevant to computer graphics? I could find similar standards from mathematics and science doing things the other way.

    As has been pointed out numerous times, every convention uses x and y to represent the most dominant dimensions. z is the poor cousin that's called in to play occasionally.

    So in computer graphics, mathematics and across much of science y is vertical. The width and height dimensions are dominant.

    In architecture, geography and some branches of engineering y is depth. This is because width and depth are the dominant dimensions.

    Other branches of engineering abandon height, width and depth altogether, for coordinate systems that better suit the problem.

    What we should all sit back and be amazed at is that all of these disparate disciplines managed to converge with x for the horizontal. That is the bizarre coincidence we should all be grateful for.
     
  37. Mwsc

    Mwsc

    Joined:
    Aug 26, 2012
    Posts:
    189
    The 2D convention is the only acceptable one as long as our monitors are 2D devices. The pixels are addressed with XY coordinates. Depth is computed by the renderer using Z. Note that devices like the occulus rift don't change this at all. The authorities might reconsider the coordinate system if we ever use volumetric displays. In any case, this is not up to you or anybody on this thread. Go read a book to find the answer.
     
    Kiwasi likes this.
  38. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    The same relation that binds physycs with International Units such meters, Kg seconds etc. Yeah we could have invented the Pleters for distances, the Lopigrams for mass etcc because we rock, but we did use International Units.
     
  39. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    @BoredMormon suppose we get 4 dimensions to work with at some point. What will the 4th axis be called? :p

    And I don't mean 'time', I mean following the geometric pattern for Nd objects:
    1d object (lines) - made of a point with no discernible dimensions
    2d object - faces are made of 1d objects
    3d object - faces are made of 2d objects
    4d object - faces are made of 3d objects
     
    Kiwasi likes this.
  40. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    An for 2D we could just have used XY with y vertical by torating the cam in teh 3D world and seeing it from avobe :).

    And for branches of engineering using XY. They will use XY all time for 2D problems but Y will change its plane of action being Y vertical when representing some problems and Y in other plane when lets say seeing the problem from avobe.
     
  41. Mwsc

    Mwsc

    Joined:
    Aug 26, 2012
    Posts:
    189
    We could use the mathematical notation where X is a vector, with components indexed as X_1 X_2 X_3 X_4
     
  42. Jonny-Roy

    Jonny-Roy

    Joined:
    May 29, 2013
    Posts:
    666
    W
     
    sootie8 likes this.
  43. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Quaternions are 4D. They use w. But not wxyz, xyzw. Go figure. (Interesting fact, Quaterions were used to represent 3D positions in space before the much more powerful Vector system we use today was developed.)

    In chemical engineering we already work in higher levels of dimensions. We normally give them common sense, non confusable names based on what they are. Like T for temperature, t for time, x1 for concentration, h for height, C for concentration, y for height and the like. We also use greek letters to eliminate any confusion. So you can use W, w, ω and Ω to represent different things. Or the same things. The system is really quite flexible.

    There is a very good reason why every chemical engineering paper and textbook starts off with a list of all of the symbols used in the work along with definitions. And every student knows to turn to those after pretty much every new equation presented.
     
  44. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    @BoredMormon oh yea, quaternions do do that, don't they... With Quaternion.Eular, I always forget that.

    Or maybe it's an upside down M, given the thread topic.

    Ew, indexes that start at 1.
     
  45. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    There's another convention that only exists in computer science. Everybody else starts at 1.

    Well mostly. The zero index is used as a special case to indicate initial conditions fairly frequently. But initial conditions hardly seem to make sense in terms of dimensions.
     
  46. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Well the first place for every number base is 0 through base-1. It makes sense to me. Could just be from obsessing over how interesting numbers and computers are since middle school :p

    This thread is starting to remind me of a troll thread on the diablo forums where someone posted an ambiguous math question. Depending on your upbringing and perspective, you would get a different answer because of the use of / in place of ÷ and no parenthesis for clarification. In ascii, it's kinda hard to tell if / is supposed to literally be ÷ or if what follows it is in the denominator, which changes something like 5 / 2 (3+1). Is that 5/2 + (3+1)/1 or is that 5 / (2 + (3+1))? It's unclear in ascii, and then there's also that apparently math was taught differently a few generations ago and there is another ambiguity in the problem.

    This thread seems to be: the answer changes based on what field you work in lol
     
    Kiwasi likes this.
  47. kdubnz

    kdubnz

    Joined:
    Apr 19, 2014
    Posts:
    177
    Personally ( of course) I believe the confusion is because to most people Y is the top of the monitor and depth has come to mean away from the viewer.

    I sure don't expect Unity to change.

    //---------------------

    While everyone is all fired up :
    What about 0,0 being at top left instead of at bottom right?? There's something worth some serious discussion.

    :)
     
    Kiwasi, Dustin-Horne and Tomnnn like this.
  48. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    That's a complete mystery. In a handful of operations, you need to subtract the y coordinate you're working with from the screen height. I think different systems within unity are using both!
     
  49. kdubnz

    kdubnz

    Joined:
    Apr 19, 2014
    Posts:
    177
    Zero based Arrays make perfect sense to me too once I learnt why they are used :)
     
    Tomnnn likes this.
  50. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,663
    Y is up. At least in every formal training I've ever had including geometry, algebra, so on... But having said that, I do agree unity should allow any axis to be any direction. Hell might as well let users rename the axes should they choose since it's a matter of changing a string here and there... But then again maybe it's not so simple lol, I've never seen the source of unity :p
     
Thread Status:
Not open for further replies.