ANYWAY, my problem is that I can not for the life of me lock or limit the freedom of any of the rotation axes. Maybe I'm not doing something right? Forgive me if that is so, I'm still relatively new to Bullet and I could not find a solution to my problem anywhere.
Here is the code that creates the joint:
Code: Select all
for(int i = 0;i < JointObjectCount;i++)
{
btVector3 APos,BPos;
APos = btVector3(JointPositions1[i].X,JointPositions1[i].Y,JointPositions1[i].Z);
BPos = btVector3(JointPositions2[i].X,JointPositions2[i].Y,JointPositions2[i].Z);
btGeneric6DofConstraint *Constraint = new btGeneric6DofConstraint(*Bodies[Joint1Objects[i]]->Body,*Bodies[Joint2Objects[i]]->Body,btTransform(btQuaternion(0,1,0,0),APos),btTransform(btQuaternion(0,1,0,0),BPos),true);
Vector3D ULimit = JointULimits[i]; //upper limit
Vector3D LLimit = JointLLimits[i]; //lower limit
Constraint->setAngularUpperLimit(btVector3(ULimit.X,ULimit.Y,ULimit.Z));
Constraint->setAngularLowerLimit(btVector3(LLimit.X,LLimit.Y,LLimit.Z));
World->GetWorld()->addConstraint(Constraint,true);
}
To test it out I just tried to constrain the pelvis object with an ellipsoid that connects the torso to the pelvis, and they stick together nicely like they should except the ellipsoid rotates freely. Even if I set ULimit and LLimit both to 0,0,0.
Could this be a problem with my bullet version? Or am I doing something wrong?
If it's me I have a feeling it may be with the third and fourth parameter of the btGeneric6DofConstraint constructor.