Problem with Hinge-limits when using two bodies

TheNinja
Posts: 4
Joined: Thu Dec 06, 2007 11:59 am
Location: Austria

Problem with Hinge-limits when using two bodies

Post by TheNinja »

Either I'm missing some import differences between a hinge with one body and a hinge with two bodies or it's a bug...
My simple test looks like this at the beginning:

P DDDDD
S
S
S

The left body is static, the right one is moved by gravity and is rotating around the point P (like a clock). The angle is starting at -90. If i only use the right body for the hinge, the limits are working fine. But if I use both bodies, the right body accelerates when the limit is reached, instead of stopping.

Code: Select all

mBtHinge = new btHingeConstraint(
        *ColBody->getBulletRigidBody (),
        *DynColBody->getBulletRigidBody (), 
        OgreBulletCollisions::OgreBtConverter::to(Vector3(0,70,0)),
        OgreBulletCollisions::OgreBtConverter::to(Vector3(0, +70, 0)), 
        OgreBulletCollisions::OgreBtConverter::to(Vector3(0,0,1)), 
        OgreBulletCollisions::OgreBtConverter::to(Vector3(0,0,1)));

/*
// this is working fine
mBtHinge = new btHingeConstraint(DynColBody->getBulletRigidBody(),
        OgreBulletCollisions::OgreBtConverter::to(Vector3(0,70,0)),
        OgreBulletCollisions::OgreBtConverter::to(Vector3(0,0,1)));
*/

mWorld->getBulletDynamicsWorld()->addConstraint(mBtHinge, true);
mBtHinge->setLimit(Math::DegreesToRadians(-140.0),Math::DegreesToRadians(-85.0),0.9f,0.3f,1.0f);
Has anyone got an idea where the problem might be?