Rigid body box stacking

Please don't post Bullet support questions here, use the above forums instead.
c0der
Posts: 74
Joined: Sun Jul 08, 2012 11:32 am

Re: Rigid body box stacking

Post by c0der »

Don't know if you're unlucky enough to come across this, but having an inertia tensor with diagonal entries 5.999995 as opposed to a plain 6, for a 1x1x1 cube of mass 1 causes instability for a single box on top of another with no friction. Manually setting it to 6 makes it stable, this is going to take me a while to debug but hope it helps anyone else if I fix it.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Rigid body box stacking

Post by Dirk Gregorius »

Why is your inertia tensor diagonal? Are you working with local angular velocities? You should transform your local inertia tensor to world space using I = R * I' * RT

Also make sure that inertia is relative to the mass center and not the position of the body. You usually keep those separate. You can use the Parallel Axes Theorem to shift the inertia tensor.

http://en.wikipedia.org/wiki/Parallel_axis_theorem
c0der
Posts: 74
Joined: Sun Jul 08, 2012 11:32 am

Re: Rigid body box stacking

Post by c0der »

Thanks Dirk. It starts off local, then I convert it to world coords per frame as you pointed out. My centroid is at the body's position anyway as it's a cube currently, will change the code later when I find the bug. It's really a minimal change in off-diagonal entries with my test case, as the box barely rotates when falling on the stack.
Post Reply