btGeneric6DofConstraint + btConeTwistConstraint

noirhero
Posts: 3
Joined: Mon Jan 05, 2009 2:00 am

btGeneric6DofConstraint + btConeTwistConstraint

Post by noirhero »

Hi.

I use btGeneric6DofConstaint.
But, there one problem.

Angular limit move like this btConeTwistConstraint.
It's very hard.

Is there good way??

PS. Sorry, my bad english.
noirhero
Posts: 3
Joined: Mon Jan 05, 2009 2:00 am

Re: btGeneric6DofConstraint + btConeTwistConstraint

Post by noirhero »

Another one problem.

Code: Select all

btGeneric6DofConstraint* pGen6Dof = new btGeneric6DofConstraint( *pBody, frameB, false );

const btScalar val = M_PI * .5f;
btVector3 angLow(.0f, -val, .0f);
btVector3 angHigh(.0f, val, .0f);

pGen6Dof->setAngularLowerLimit(angLow);
pGen6Dof->setAngularUpperLimit(angHigh);
180 degree over constraint in object angular motion.
Motion is very strange.
Is it bug?
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm

Re: btGeneric6DofConstraint + btConeTwistConstraint

Post by Dr.Shepherd »

What I tried and found before, is that, when I set the angle to be PI/2, it actually doesn't go the correct place. If you mean this ?

I don't know what's going wrong either, this should be a simple mistake we made somewhere, could anyone have similar experience and find out later?
noirhero
Posts: 3
Joined: Mon Jan 05, 2009 2:00 am

Re: btGeneric6DofConstraint + btConeTwistConstraint

Post by noirhero »

Thank you for reply.

Yeah, I think it's right.
Set less than PI/2 correct this problem.

And,
the answer to first question?
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm

Re: btGeneric6DofConstraint + btConeTwistConstraint

Post by Dr.Shepherd »

noirhero wrote:Hi.

I use btGeneric6DofConstaint.
But, there one problem.

Angular limit move like this btConeTwistConstraint.
It's very hard.

Is there good way??

PS. Sorry, my bad english.
If you mean the difficulty is the intuitive expression onf btQuaternion, then I would suggest that:

Set an Angle to the constraint:
1. Set up an Angle in Degree expreesion, and definitely you know its rotation axis...
2. transform it into btQuaternion by one of btQuaternion's constructor:

Code: Select all

btQuaternion: btQuaternion (const btVector3 &axis, const btScalar &angle)
Or directly use:

Code: Select all

btQuaternion: setRotation (const btVector3 &axis, const btScalar &angle)
3. Pass this Quaternion into the constraint

You can get the Quaternion from the constraint first, then transform it into the normal angle expression.

Cheers, hope this is what you want !