btGeneric6DofSpringConstraint gets stuck at angular limits

Dalorin
Posts: 7
Joined: Mon Jun 11, 2012 10:31 am

btGeneric6DofSpringConstraint gets stuck at angular limits

Post by Dalorin »

Hi

I have one static rigid body and one dynamic RB constrained with a btGeneric6DofSpringContraint. The linear axes and one of the rotational axes are locked so that the constraint behaves like a ragdoll with no twisting.

The constraint behaves well unless the dynamic RB hits one of the angular limits, at which point it either sticks to the limit or slides along it before releasing and springing back as intended. This seems to be exacerbated when gravity is enabled. Without gravity, the RB will free itself within a second or two. With gravity, the RB can only be freed by applying an external force.

Any suggestions?
David
Dalorin
Posts: 7
Joined: Mon Jun 11, 2012 10:31 am

Re: btGeneric6DofSpringConstraint gets stuck at angular limi

Post by Dalorin »

I've done some more digging. As the RB approaches the limit, it violates it by a small amount. At this point, the body's velocity drops near zero and it crawls back toward the limit in minute increments. As soon as the body crosses the limit again, velocity increases substantially and the body swings back toward the equilibrium point and then gets stuck again on the other side. Repeat ad infinitum.

My investigation led me to consider the value of m_rhs for the constraint. This value gets very low as soon as the constraint is violated. Worryingly, there's a comment at this point in the code reading "fix rhs" with no further explanation (see http://code.google.com/p/bullet/source/ ... er.cpp#923).

Does any of this sound familiar to anyone?

Thanks
David