(Resolved) Stacking objects. Boxes fall over, Spheres stack and stand

Hey there, I have an input action that drops an object into my scene using this code:


          Box block = new Box( "block", new Vector3f(-1,-1,-1),new Vector3f(1,1,1));//1, 40, 40, 1f );
         DynamicPhysicsNode n = getPhysicsSpace().createDynamicNode();
         n.attachChild(block);
         n.generatePhysicsGeometry();
         n.setLocalTranslation(new Vector3f(0,100,0));
         n.setMass(0.01f);
         rootNode.attachChild(n);



Now, as boxes, these topple all over the place, but as spheres, they stack up through the sky.  Also, a stack of boxes that are defined in their correct positions in the stack (so they don't fall at all), will make a stack for a little while (couple of minutes at best), but slowly the blocks shift out of line and the tower falls over.  Any wisdom on whats happening here?
Core-Dump said:

one problem with auto-disable is, that once the  wall is at rest, you can kick away the lower boxes and the upper ones keep floating in the air.

yes, I'm aware of that problem. It's a todo in the readme: nodes should be unrested when a contact point disappears. Unfortunately this is not done easily, as one would need to identify contact points... probably we could use a workaround first: remember all nodes a node is in contact with and unrest those nodes if the current node is moved/unrested? maybe you can test that...

try to make a stack of Boxes with Osmium Material, it will be more stable than for example wood because its a harder/heavier material.



I noticed too that a stack of wooden boxes is too unstable, compared to real world that is :), but i don't know how to improve that.

You can use auto-disable to improve stability.



Sphere do stack better (if perfectly above each other) because collision detection results in a single contact point. Boxes create 3 to 4 contact points - a small variation in rotation causes oscillation between 3 and 4.

one problem with auto-disable is, that once the  wall is at rest, you can kick away the lower boxes and the upper ones keep floating in the air.



You have to periodically call unrest() to let the floating boxes fall down.

(One more soon to be feature of Physics Fun :))

Makes sense.  I would love to help you guys develop some of this stuff but I'm worried that my noob-ness will only make things worse.  When I learn more about all of this (I just got into 3d programming 2 weeks ago), I'll be contributing code i'm sure.   



Thanks for the answers!