Box stacking problems

Feb 19, 2010 at 8:40 PM
Edited Feb 19, 2010 at 8:43 PM


Very impressed with what I have seen of Oops so far. I want to use the physics component in my game, and I have set up a very basic box stack resting on a plane (the game I'm working on will have alot of these). What puzzles me is why the demo box stack seems so stable, whereas my boxes fall over.

Oops seems really simple to set up, and I can't see any difference between my code and the demo code, so I'm wondering if I've missed anything out or whether this is something to do with the speed my game engine is running at (about 150 fps) which is a lot slower than the framework (if I really slow things down, the boxes keep bouncing around on the ground plane).

Am I doing something stupid, or is this to do with my frame rate, or some other issue with the collision system or the solver?

I've included a summary of my code below, and a video here: 

/*Game init*/

GameApp.s_physics.AsyncEnabled = false;
GameApp.s_physics.Enabled = false;

/*Physics objects (boxes) init*/

CollisionBox box = new CollisionBox();

BoundingBox bb = m_aabbox.Value;

box.Extents = (bb.Max - bb.Min) / 2.0f;

box.StaticFriction = 0.5f;

box.DynamicFriction = 0.5f;

box.Restitution = 0.6f;

// Create a rigid body for the box.

m_rigidBody = new RigidBody();



m_rigidBody.UpdateTransform(ref m_position, ref m_rotationMatrix);

// Add the box's rigid body to the physics component.


protected override void Update(GameTime gameTime)

//Engine update done here



 I'd really appreciate some advice on this, if it is a physics issue then I'll need to rethink my game design.
Many thanks in advance.


Feb 19, 2010 at 9:42 PM

hi ardmark,  thanks for the kind words about my project.

It's funny you should mention this issue (i.e, box stacking).  I should have a potential fixes coming in a few days.  If you can wait until then It should work a lot better. 

The issue revolves around, like you said, the frame rate dependence of framework and just my box collision detection code.  I've improved both and am hoping to have a new release over the weekend.

Feb 19, 2010 at 11:25 PM

That's great, thanks,