Stacking

Hi,
I'm having some problems stacking some squares. I guess it's because of the time interval, but whenever I stack the objects they fall over. Is there any way to get them to stand still? I tried making friction 1, density 1... Any ideas?

Thanks,

-Danny
That's a lot of friction, which might help, but probably isn't what you want as it might make things act "sticky". What is your timestep and # of iterations set to?
I've only played with 2.0 but, when you drop a rectangle with a high restitution straight onto a flat surface, it gets a surprisingly large angular velocity after the bounce. I played around with this a bit and I think it has to do with how the velocity constraints are solved (b2ContactSolver::SolveVelocityConstraints). The angular velocities for the two constraint points (the corners) should cancel each other out. Since the velocities are updated inside the loop you get feedback in the second iteration and the angular velocities don't cancel each other out.

I moved the vel updates for the normal constraints outside the loop and I get straight-up bounces and better stacking behaviour with boxes. The pyramid test with increased gravity (-50) and an iteration count of 20 sticks the landing (before it needed ~35).

Cheers,
Frank.

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