Question about appConstraintDemo

Butters9637
Posts: 7
Joined: Tue Mar 06, 2007 3:26 am

Question about appConstraintDemo

Post by Butters9637 »

Okay, after reading some posts here, I have to edit the my post again. I`m new to physics engine and I want to know how to lock some degrees of freedom using constraint? for example X axis. thanks
luke.titley
Posts: 15
Joined: Fri Sep 08, 2006 3:39 pm

Post by luke.titley »

Hey,
Which degrees of freedom would you like to lock?

You can have a Hinge, point2point ( ball and socket ) or a Generic6Dof joint.
The Demos/ConstraintDemo directory in the download of the bullet sdk has examples of them all.
User avatar
SteveBaker
Posts: 127
Joined: Sun Aug 13, 2006 4:41 pm
Location: Cedar Hill, Texas

Post by SteveBaker »

luke.titley wrote:Hey,
Which degrees of freedom would you like to lock?

You can have a Hinge, point2point ( ball and socket ) or a Generic6Dof joint.
The Demos/ConstraintDemo directory in the download of the bullet sdk has examples of them all.
The Generic6Dof constraint is the only one that you can sellectively lock axes of. Also, the point2point and hinge constraints don't have limits - so if you have a hinge, the object can rotate 360 degrees (unless it hits something) and if you use point2point, it'll be able to move in all three rotational axes without limits.

Generic6Dof ought to be the way to go - but I havn't had much luck with it - even if you lock a bunch of the axes, the object will kinda wobble around in those directions like it's mounted on a block of jello.

Bullet needs some serious work on it's constraint system.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Yes, more work on the constraints, motors and limits (angular and plane limits) is desired and definately on the long todo list.

Collision detection and cleanup has received most attention,
please stay tuned,
Erwin
Butters9637
Posts: 7
Joined: Tue Mar 06, 2007 3:26 am

Post by Butters9637 »

Code: Select all

slider->SetLimit(0,-1.0f,-1.0f);
slider->SetLimit(1,-1.0f,-1.0f);
slider->SetLimit(2,-1.0f,-1.0f);
slider->SetLimit(3,1.0f,1.0f);
slider->SetLimit(4,1.0f,1.0f);
slider->SetLimit(5,1.0f,1.0f);
I try to lock all 6 directions using the code above.but It simply doesn`t work,the Box could still move around if I drag it using my mouse. how to solve it? thanks.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

By default, without setting any limits they are all locked. This means both lower and upper limit values are 0.

One of the issues with the generic 6dof constraint is that the various degrees of freedom have dependencies and can conflict with eachother.
The angular dofs are order dependend, and use X-Y-Z by default. This means that if you want one rotation axis to be free, you should use the x-axis.

Please try experimenting enabling one degree of freedom at a time. You can make one degree of freedom totally free by setting the upper limit lower then the lower limit.

Hope this helps,
Erwin
Butters9637
Posts: 7
Joined: Tue Mar 06, 2007 3:26 am

Post by Butters9637 »

After doing some experiments I think I generally know what this constraint is capable of. thank you very much for you patiently explanation about this issue :D .

Edit:I tried the new version of Bullet, it works this time. thank you.