I've created 2 hinge parts in Shiva, each one comprising a standard cube with a smaller resized cube as a hinge tongue attached to it. I've aligned these so they are touching, as per a standard hinge joint shown in the Bullet manual. I've put these "joined" objects in my scene, suspended in mid air, so when i start the simulation they should fall down together, but be constrained at the hinge joint.
If I add a box rigid body to each object, spanning to end of the tongues, and make both bodies dynamic, when I start the simulation, they two objects explode away from each other, and when they settle down in out-of-whack orientations, the hinge joint tries to work but naturally looks out of place compared to the objects.
If I make one of the objects static, the other one swings around it with a correct hinge connection. I don't care about angle limits or anything at the moment, I just want to see the hinge joint holding my 2 objects together.
All I have done to create the hinge joint is
Code: Select all
btHingeConstraint* newConstraint = new btHingeConstraint(*bodyA, *bodyB, btVector3(nPivotXA, nPivotYA, nPivotZA), btVector3(nPivotXB, nPivotYB, nPivotZB), btVector3(btScalar(nAxisXA), btScalar(nAxisYA), btScalar(nAxisZA)), btVector3(btScalar(nAxisXB), btScalar(nAxisYB), btScalar(nAxisZB)));
physicsWorlds[currentWorldID]->addConstraint(newConstraint);
Code: Select all
pHinge2->setLowerLimit(-SIMD_HALF_PI * 0.5f);
pHinge2->setUpperLimit( SIMD_HALF_PI * 0.5f);
Thanks.