Add Motors to Cone Twist Constraint

physicsgeek
Posts: 2
Joined: Fri Apr 17, 2009 4:01 pm

Add Motors to Cone Twist Constraint

Post by physicsgeek »

Hello,

I am currently switching my project from ODE physics to Bullet. The main reason is Bullet seems to be in a more active state than ODE.
From what I have been experiencing until now it seems more stable as well (or at least default settings make it more stable by default).

Now the question I have: Is there any plan to add a "Motor" feature to the btConeTwistConstraint object that would allow to apply torques about the 3 axes independently to both attached Rigid Bodies?
If not there is probably already a way to do that... Or should I apply torques directly to the 2 Rigid Bodies withput taking any care of their ConeTwist Constraint.

Thank you.
User avatar
projectileman
Posts: 109
Joined: Thu Dec 14, 2006 4:27 pm
Location: Colombia

Re: Add Motors to Cone Twist Constraint

Post by projectileman »

Anything that currently you do with btConeTwistConstraint.h you can do it better with btGeneric6DofConstraint.

And the good new is that btGeneric6DofConstraint class has already motors in its 3 rotation axis.

btConeTwistConstraint class is just designed for simulating loose ragdolls only. If you want articulated robots, then use btGeneric6DofConstraint class for joints.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Add Motors to Cone Twist Constraint

Post by Erwin Coumans »

The btConeTwistConstraint has motors, but you have to enable the 'obsolete' mode (check the code).

Eddy has some recent improvements and feedback on the btConeTwistConstraint, see also the discussion here:
http://www.bulletphysics.com/Bullet/php ... f=9&t=3505

As projectileman mentioned, you can also consider using the btGeneric6DofConstraint. Your mileage might vary with either.
Hope this helps,
Erwin
physicsgeek
Posts: 2
Joined: Fri Apr 17, 2009 4:01 pm

Re: Add Motors to Cone Twist Constraint

Post by physicsgeek »

Thank you for your prompt answers. I will do some tests with the six degrees constraints. Apparently it's a more generic constraint ;)

Also I have notice that when linking three "bones" with the ConeTwist constraint there is a kind of "spring like" perpetual motion with specific constraint values...

For example CT1 and CT2 are ConeTwist with TwistSpan Constraint = 0.0f, SwingSpan1 = PI / 4, SwingSpan2 = 0.1f

Bone1 -CT1-> Bone2 -CT2-> Bone3

Bone2 and Bone3 don't stop shaking.
Is there any kind of damping force that can be added to the constraint to minimize this effect? I have tried using the setDamping function of the constraint itself but it does not help. I have also raised the damping effect of all my rigid bodies to 0.6f with no luck.
Thanks for your time.
User avatar
projectileman
Posts: 109
Joined: Thu Dec 14, 2006 4:27 pm
Location: Colombia

Re: Add Motors to Cone Twist Constraint

Post by projectileman »

With btGeneric6DofConstraint class you can handle that shaking problems easily.
Check at line 46:
http://code.google.com/p/bullet/source/ ... nstraint.h

The motors of btGeneric6DofConstraint already have parameters for damping and softness. You can configure them like in ODE, retrieving each motor per axis with the getRotationalLimitMotor() method.

I didn't have the need to use ConeTwist constrains since btGeneric6DofConstraint class does all what I want. What I know is that ConeTwist constrains are made JUST for ragdolls; they're just optimized for an special case of loose falling ragdolls where accuracy is not needed; a dead body could shake weirdly and players don't care about.