Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Jan 06, 2011 6:40 am 
Offline

Joined: Thu Jan 06, 2011 6:10 am
Posts: 1
So, here's my story. I just registered here (but I've been visiting this site quite often lately) because I'm using Bullet Physics for a game. I've checked out the ragdoll demo that uses the btGeneric6DofConstraint and it did not really help me much with my problem. I am not quite sure which bullet version I am using, I just know it's less than or equal to 2.70. The game I am developing is for the PSP and the ITouch, it is a ragdoll physics game and the details are really not that important.

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:
    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);
    }


Don't mind all the arrays and stuff, that is all generated from sort of a script file that loads the body part meshes and adds them to the dynamics world and creates constraints between them to make a ragdoll. I've already checked that process for errors several times and I have found none. So the problem is not with that.

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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot], xexuxjy and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group