View previous topic :: View next topic |
Author |
Message |
mike
Joined: 28 Dec 2008 Posts: 34
|
Posted: Sat Mar 28, 2009 10:56 pm Post subject: World's aabb Problem |
|
|
I noticed that there is a size limit for the worlds aabb. The box doesnt seem to be bigger than bVec2(1000, 1000) for upperbound.
Is it not suppose to be bigger?
If it is, is there a way I could make it bigger or possibly do without the world's aabb? |
|
Back to top |
|
|
zzzzrrr
Joined: 17 Feb 2007 Posts: 139 Location: Washington, DC
|
Posted: Mon Mar 30, 2009 4:32 am Post subject: Re: World's aabb Problem |
|
|
mike wrote: | I noticed that there is a size limit for the worlds aabb. The box doesnt seem to be bigger than bVec2(1000, 1000) for upperbound.
Is it not suppose to be bigger? |
No. There are limits to box2D's broad phase collision detection algorithm.
mike wrote: |
If it is, is there a way I could make it bigger or possibly do without the world's aabb? |
You could always try using multiple worlds if you need a space that big. Practically though, most of your shapes should all be < 10m. When you get to an upper bound of 1000 and a lower bound of -1000 you're talking about huge scales.... not something you probably really need in a 2D game. For example, the Sears Tower is 442 m.
If you're making a space based type of game or global strategy game or something, just scale everything down appropriately.
Again, you might want to check the box2D wiki:
Quote: |
Box2D works with floating point numbers, so some tolerances have to be used to make Box2D perform well. These tolerance have been tuned to work well with meters-kilogram-second (MKS) units. In particular, Box2D has been tuned to work well with moving objects between 0.1 and 10 meters. So this means objects between soup cans and buses in size should work well.
Being a 2D physics engine it is tempting to use pixels as your units. Unfortunately this will lead to a poor simulation and possibly weird behavior. An object of length 200 pixels would be seen by Box2D as the size of a 45 story building. Imagine trying to simulate the movement of a high-rise building with an engine that is tuned to simulate ragdolls and barrels. It isn't pretty.
*** Caution ***
Box2D is tuned for MKS units. Keep the size of moving objects roughly between 0.1 and 10 meters. You'll need to use some scaling system when you render your environment and actors. The Box2D examples do this by using an OpenGL viewport transform.
|
|
|
Back to top |
|
|
mike
Joined: 28 Dec 2008 Posts: 34
|
Posted: Mon Mar 30, 2009 12:03 pm Post subject: |
|
|
Yeah I did look at box2d wiki but I didn't think anything of the size of the objects. The size change would probably work out for me.
Thanks. |
|
Back to top |
|
|
|