This project is read-only.

Creating ground

Mar 5, 2010 at 3:28 AM

So I'm definitely a noob to this, but I like to think I'm a quick learner. I know how to create a body and attach a shape so that they collide, but I noticed that the xna version differs from the C++ version of Box2D in that you cannot provide a bounding box to the world. I could always just create the ground using rectangular shapes, but something tells me thats not the best way to do it. What is the best way to approach this problem?

Mar 6, 2010 at 9:41 PM

The C++ version no longer has a bounding box on the world, and in the older versions that do have one it is not really something you collide with (you'll probably get an exception if something goes outside of that bounds).

For the latest Box2D versions, including Box2D.XNA, you'll want to create static walls using SetAsEdge.  Take a look at the ApplyForce test in the Box2D.XNA testbed which does exactly what you describe.