Box2D Forums

It is currently Thu May 23, 2013 12:04 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Coordinates
PostPosted: Thu Aug 07, 2008 5:42 am 
Offline

Joined: Fri Jul 18, 2008 7:23 am
Posts: 47
Hey guys,

i have an ask, are the box2D coordinate ( 0|0 ) the top left corner of the window or is it the middlespot ?


Top
 Profile  
 
 Post subject: Re: Coordinates
PostPosted: Thu Aug 07, 2008 7:15 am 
Offline

Joined: Wed Dec 19, 2007 1:19 pm
Posts: 34
I'd say the coordinates of the physics world are neither. The physics world is completely separate from your visual world.

In Box2D, 1 unit is by default 1m. But you can map this however you want to your visual world. In a project I was with, we used 100px for 1 unit/m, as it's recommended to keep the physical world small. 1px = 1m is not recommended as you'll lose precision over large distances and objects will quickly get very heavy although their shapes are small pixelwise.

I think it's recommended to keep the center of your physical game world around the origin [0,0]. This way your game world can extend in all directions and lose less precision. But as the physical world is decoupled from the actual coordinates your game world uses, you can of course do any math/translations/transformations you wish when converting between the game world coordinates and the physical world coordinates. Just as you have to do some transformations for your game world onto the screen coordinates, escpecially if you have a scrolling world or you can zoom in and out with the camera.

There should be a setting to change things like unit relationships in Box2D header b2Settings.h.


Top
 Profile  
 
 Post subject: Re: Coordinates
PostPosted: Thu Aug 07, 2008 8:05 am 
Offline

Joined: Tue Feb 12, 2008 4:54 pm
Posts: 130
TwoD wrote:
I'd say the coordinates of the physics world are neither. The physics world is completely separate from your visual world.


QFT :)

It's all very arbitrary. What is up or down when a simple rotation (or scaling!) at render time displays it on the screen as you'd like?

Bill


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group