How to make a correct limbo-hinge? ( door-wall example )

bindumol
Posts: 15
Joined: Thu May 08, 2008 9:55 am
Location: India, Kerala

Re: How to make a correct limbo-hinge? ( door-wall example )

Post by bindumol »

Hi Dragonlord,
Is there any way to restrict a rigidboy upto a fixed tranformed position, when we apply a torgue force into it...that means restrict the body movement to a certain point that is calculated by some input data that we are given, and the force applied is that much amount, but if the force value is high then also the body should be stopped at the position...
Please help me
Regards,
Bindumol
User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

Re: How to make a correct limbo-hinge? ( door-wall example )

Post by Dragonlord »

Usually you simply have to create a hinge with the transforms composed in a way that they represent the rigid body in the 0°-position. Then use setLimits ( I think it's called like this, don't have the source code on this machine right now ) with the proper swing distance. Once done your rigid body should not swing past this position. The hinge constraint is though a bit... quirky. It tends to violate the limits by roughly 1 or a half degree but I think this is going to be fixed upon time.

What goes for applying the right force depending on the relative position best way is to keep your own data structure around tracking the rotation updating the rigid body accordingly. This way you can apply the force or torque depending on this value and whatever management parameters you need. I always obtained the best results by using Bullet only as output library and reading as few values from it as possible. Less complicate and more stable this way.