Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that for Box2d I need to translate pixels to meters which is easy peasy. However my problem is what is the orientation of Box2D coordinates system? Is this the same as screen one (right += x, bottom += y) or it is like cartesian (right +=x, bottom -= y) ?

Also, does Box2D coordination system use negative values?

Thank you.

share|improve this question
It should not matter so long as your are consistent. Just use the same one as the rendering technology you are using to avoid confusion. – ClassicThunder Feb 14 '13 at 19:18
@ClassicThunder I think that for example it matters for gravitation. I mean when a body is dropping, box2d will decrease its Y and on the screen it would go up in that case, if it uses cartesian system. – user1873947 Feb 14 '13 at 19:21
"I mean when a body is dropping, Box2D will decrease its Y" You can specify the direction of gravity and so long as you are consistent it works. I use a gravity value of (0, 98.1) for my game because the top left is 0,0 and higher values of y are towards the bottom of the screen. – ClassicThunder Feb 14 '13 at 19:32
@ClassicThunder So that's a good news, I can use screen coordinates in Box2D. If you want create an answer describing it and I will accept it. – user1873947 Feb 14 '13 at 19:34

According to a post I located on the Box2D forums here, it uses your renderer's coordinate system, with some coefficient relating world space units to renderer units.

The testbed for Box2D supposedly uses OpenGL, in which Y+ is up, X+ is right, and Z+ is projecting out from the monitor's surface.

Also, an article I found here mentions the SCREEN_TO_WORLD and WORLD_TO_SCREEN global parameters, and provides an implementation of a Camera class to overcome the challenges of the somewhat-poor intentionally-separated implementation of this in Box2D. Even if you're already past this point, it may provide further insight into what you're trying to accomplish.

Sorry if this isn't really a true answer, but I hope I've at least pointed you in the right direction.

share|improve this answer
so it seems like it is cartesian system and values can be negative. So it's not really render system unless you use opengl/directx. Thank you for the links. – user1873947 Feb 14 '13 at 18:58

Note, that there is nothing like "left - right orientation" in mathematics. When you have vector spaces, everything works perfectly without having to define, what is left and what is right. It depends only on how you draw it (e.g. gravity vector (0, -1) and Y going "up" is equivalent to gravity vector (0, 1) a Y going "down").

share|improve this answer

A detailed answer is here with demo code. (box2dweb specific, but gives a clue)

Box2d coordinate system for HTML5 Canvas

share|improve this answer
Hello and welcome to GDSE. Even thou, that link might has the answer, it would be better if you write the answer here. Links tend to rot and eventually die. So, try to answer so, that no external data is needed. That way answer stay online for long time. – Katu Aug 12 '13 at 17:02
That makes sense. Thanks! – Farhan Arshad Aug 15 '13 at 10:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.