• 2D
  • Weird coordinates in the editor

Hey there,I started using Godot recently and I must say I'm impressed and really impatient to finish the tutorial to start making games.Yet, something still bothers me in the 2D editor: why are the Y-coordinates reversed ? I noticed when making the Pong game that despite the size of the window being 640X400, a higher y-coordinate means going down on the window. Thus, to make the pad (or any moving object) go up or to set an object to a certain height, you need to decrease its y-coordinate which i find really counter-intuitive.Is there any way to change some parameters in the editor in order to have the y-coordinates up (and/or to set the origin at the left-bottom of the window) ?Thanks a lot  ;)

I would find it weired if 0,0 would be in the bottom left corner. Every engine/framework I know has 0,0 in the upper left corner, just like godot

This is how the X/Y coordinate system works in every engine I've ever touched. GameMaker, Unity, DarkBASIC Pro, App Game Kit, and even Monkey X. To go "up" in Y, you have to decrease the value of Y. Say you want your character to jump, for example. Instead of adding +5 units to the velocity in Y, you would instead subtract 5 units. So, decreasing the Y position of the paddle in Pong to make it go up makes perfect sense. The top of the window or screen is Y = 0.

maybe it's the same in every game engine you both have ever touched but Mathematically speaking any y > 0 should be above the origin and inverting it, no matter the reason, is awfully counter-intuitive for in the mind of most people going UP is associated with increasing the y-coordinate. Maybe they should let the devellopers choose where they want their origin

It makes sense the way it is, once you are used to it.Think about it - to go down in Y, it makes sense to increase the value.  It's just like going right in X, you must increase the value to do that.  To go left you decrease the value of X.  Likewise, decreasing the value of Y is going up, and increasing it is going further down the screen. Is this the first time you are playing with any game engine (not just Godot)?

[quote author=BinaryOrange link=topic=15442.msg15965#msg15965 date=1461755881]Is this the first time you are playing with any game engine (not just Godot)?[/quote]Well it is the first time I'm playing with a 2D game engine (i've also started learning UE4) so until now I was used to the way it's done in maths. I'm sure it was inverted in Godot (and others since you both seem to agree on the fact that it's done this way in other game engines too) for a reason but until the day this reason is explained to me, I'll consider it more intuitive to do it the mathematical way ("+"=UP, "-"=DOWN). Maybe the developpers could add an option to modify the placement of the origin and invert the y-coordinates. I don't know how much code it would require but I don't think (though I'm not an expert) it would require to start all over again and I really think it would improve the flexibility of the engine

Oh, I think I see what you're saying. Yes, Y is indeed "inverted" in 2D as opposed to 3D.  Up in Unreal is +500 in Z (or Y, if you use Unity), so now I understand the confusion. Yes, it took me a while to adjust to that too, but I have been playing around in 2D game development more than 3D lately so now it just seems totally natural to me.  I'm not sure if they could add in the option to "flip" the way it works, as it would make several scripts likely work incorrectly in the long run.  Still, certainly a thing to consider!

Thank you Megalomaniak for your link. I now get why they did it that way.And I'm happy that BinaryOrange and I could finally understand each other  :).I don't think inverting the y-axis would create such problems. If it is an option present in the "engine.cfg" file every script for that specific project will run quite well I think. Do you know where I could eventually suggest it to the devs of Godot ? (I would do it myself if I were a better programmer  ;D)

[quote author=AnthoJack link=topic=15442.msg15962#msg15962 date=1461735678] maybe it's the same in every game engine you both have ever touched but Mathematically speaking any y > 0 should be above the origin and inverting it, no matter the reason, is awfully counter-intuitive for in the mind of most people going UP is associated with increasing the y-coordinate. Maybe they should let the devellopers choose where they want their origin[/quote]Actually no. Mathematically speaking it all depends on the way you define your system, and in game engines or other OpenGL/DirectX based applications the conventional system is [Ox) pointing to the right of the screen and [Oy) pointing to the bottom of the screen.The system is still cartesian if you consider that the [Oz) axis would be pointing away from the player and into the screen. Which is what makes the most sense, using a cartesian system with [Oy) pointing upwards and [Oz) pointing in your face would be counter-intuitive: the depth of the game starts at the screen, and can go beyond it, but not behind the player.