Issue with the btGeneric6DofSpringConstraint

OSasuke
Posts: 47
Joined: Tue Dec 09, 2008 10:12 am

Issue with the btGeneric6DofSpringConstraint

Post by OSasuke »

Hello every one.
I am currently working on animating ragdoll using motorized contraints, but i get an unexpected behaviour from the 6DOF constraint.

I setup my constraint this way :

Code: Select all

btTransform t1, t2;
t1.setIdentity(); t2.setIdentity();
t1.setOrigin(btVector3(0.7f,0.f,0.f));
t2.setOrigin(btVector3(-1.1f,0.f,0.f));
btGeneric6DofSpringConstraint* rc0 = new btGeneric6DofSpringConstraint(rigidbody1, rigidbody2,
                                                                       t1, t2, false);
Until now, there is no problem but when i enable motor and set m_targetVelocity the constraint moves my rigidbody2 in the opposite direction.

Code: Select all

                    btRotationalLimitMotor* rotLim = rc0->getRotationalLimitMotor(i);
                    rotLim->m_enableMotor = true;
                    rotLim->m_targetVelocity = 25.f;
rigidbody2 is supposed to rotate in the positive direction (anti-clockwise) but it turns in the negative direction.

What i don't understand is that all works fine when i do the following :

Code: Select all

btTransform t1, t2; // No change
t1.setIdentity(); t2.setIdentity(); // No change
t1.setOrigin(btVector3(0.7f,0.f,0.f)); // No change
t2.setOrigin(btVector3(-1.1f,0.f,0.f)); // No change
btGeneric6DofSpringConstraint* rc0 = new btGeneric6DofSpringConstraint(rigidbody2, rigidbody1,
                                                                       t2, t1, false); // inversed the order
Is there any way to solve this differently from what i did, because this have no sense to me !
Note that in some cases it work's fine without doing any change. Can anyone explain to me what's wrong ?

Thanks.
OSasuke
Posts: 47
Joined: Tue Dec 09, 2008 10:12 am

Re: Issue with the btGeneric6DofSpringConstraint

Post by OSasuke »

Up :arrow:
OSasuke
Posts: 47
Joined: Tue Dec 09, 2008 10:12 am

Re: Issue with the btGeneric6DofSpringConstraint

Post by OSasuke »

UpUp ? :!: