Given:
Body1: pos = -0.5, 0, 0 and quat = 0.70710676908493 0 0 0.70710676908493 (90 degree rotation from identity)
Body2: pos = 0.5, 0, 0 and quat = 1 0 0 0
Attach joint:
Code: Select all
btTransform frameInA, frameInB;
frameInA = btTransform::getIdentity();
frameInB = btTransform::getIdentity();
frameInA.setOrigin(btVector3(0., 0., 0.));
frameInB.setOrigin(btVector3(0., 0., 0.));
// frameInA.setRotation(btQuaternion(0.70710676908493, 0, 0, 0.70710676908493));
//frameInB.setRotation(btQuaternion((0.70710676908493, 0, 0, 0.70710676908493));
m_joint = new btGeneric6DofConstraint(
body1,
body2,
frameInA,
frameInB,
true
);
btVector3 lowerSliderLimit = btVector3(0.2, 0, 0);
btVector3 hiSliderLimit = btVector3(1.5, 0, 0);
m_joint->setLinearLowerLimit(lowerSliderLimit);
m_joint->setLinearUpperLimit(hiSliderLimit);In the images, X-axis is blue and Y-axis is pink. The white points is the joint origin in world coordinates on each body and the white lines the axes of the joint on each body
initial condition:

final state due to constraint:

How can I setup the joint such that it constraints the -y-axis of body1 (on the left) and the -x-axis of body2 (on the right) to align? In this test, I want the final state of the objects to be both on the x-axis 1.5 units apart.