Box2d for 3d game

Hello,
I'm working on a little 3d game with "sandy3d", and I want to put some physics in it so I decided to use box2d.
I started to make my 3d world into box2d with top to down effect, I set the DebugDraw on to check, but I don't get it, why the world is not well center in my window?

And what are your advice for me to simulate my 3d world? (like no gravity and stuff)

Here is my world declaration:
Code:
var worldBox:b2AABB = new b2AABB();
worldBox.lowerBound.Set(-512/30,-512/30);
worldBox.upperBound.Set(512/30,512/30);

How does Bounders works? I have a map of 1024*1024, is my declaration correct?

Here is my DebugDraw:
Code:
var dbgDraw:b2DebugDraw = new b2DebugDraw();
dbgDraw.m_sprite = new Sprite();
addChild(dbgDraw.m_sprite);
dbgDraw.m_drawScale = 5.0;
dbgDraw.m_fillAlpha = 0.3;
dbgDraw.m_lineThickness = 1.0;
dbgDraw.m_drawFlags = b2DebugDraw.e_shapeBit |b2DebugDraw.e_centerOfMassBit;
myWorld.SetDebugDraw(dbgDraw);


Thank you
First off, debug draw will simply draw into the sprite that you provide to it. If you want that to be centered in your flash stage, then center the sprite, (you haven't given it a variable name, so I recommend:)
Code:
myDebugDrawSprite = new Sprite();
dbgDraw.m_sprite = myDebugDrawSprite
myDebugDrawSprite.x = STAGE_WIDTH/2
myDebugDrawSprite.y = STAGE_HEIGHT/2


Secondly, the worldAABB or world bound, is not the way to make a "wall" around your simulation. This is simply the bound within which physics will be simulated, objects leaving the worldAABB will simply stop moving or colliding.
Dankuwel for the reply,
About the walls in my world I figured it out, by testing it, so you advise me to make a world bigger than the actual size of my map and just place fixed objects as walls?

What are the settings to simulate a car driving on a floor? Like "density", "friction", "restitution", forces to apply etc..

Thank again
Silo wrote:
So you advise me to make a world bigger than the actual size of my map and just place fixed objects as walls?

Exactly.

And as far as top-down physics is concerned, take a look at:
viewtopic.php?f=8&t=1547
viewtopic.php?f=3&t=1662
Thank you,
I've seen your top-down simulation already and it's exactly the way I want to do mine.
I changed the settings to resize it as my world but as the shapes change the acceleration change too and the cars goes too fast and when rotate, it can't stop rotating? Do you know what can change that effect? Sorry for dumby question, I tried to find answer in the post you send and I couldn't.

A final dumby question, if it's not too much for you, are the wheels necessary for my simulation? Can't we just apply force on the square?
You can apply force directly on the square, but that would make it a bit harder for you to make the car behave like a car. One other solution is Boris' TensorDampingController (do a search on the forum). That way you can simulate the car with a very high "sideways friction" (meaning the rectangle can 'roll' forward or backward, but not 'slide' sidewards)

As far as the demo is concerned: if you scale the objects, make sure to scale other factors (like linearDamping and angularDamping) too.

Original thread: https://box2d.org/forum/viewtopic.php?t=3062