Code: Select all
// BodyA is out in the world, not at the origin.
btTransform localA;
localA.setIdentity();
localA.setOrigin( btVector3(0, 0, -1); // Some point, not zero.
// BUG: doesn't put origin of second frame at the right place
//pJoint = new btConeTwistConstraint(*pBodyA, localA);
// WORKAROUND:
static btRigidBody fixed( 0, 0, 0 );
btTransform localB = localA;
localB.setOrigin( pBodyA->getCenterOfMassTransform() * localA.getOrigin() );
pJoint = new btConeTwistConstraint(*pBodyA, fixed, localA, localB);