Hinge constraint sticks to upper limit

Post Reply
RedLagger
Posts: 4
Joined: Wed Mar 23, 2016 1:56 pm

Hinge constraint sticks to upper limit

Post by RedLagger »

I may have found a bug in the hinge constraint limits, and I was able to re-create this bug in the example browser. In ConstraintsDemo.cpp, I modified the door rigid body so that it has a mass of 10.0, and an "axisA" of ( 0.0, 0.0, 1.0 ). I also removed all the other rigid bodies just for simplicity. Then I run the demo, grab the door, and rotate it upwards so it reaches its upper constraint. I hold it there a few seconds until it stops moving/shaking, and then when I release the mouse button, the door remains stuck at the upper limit.

I would think that it would begin to rotate back down due to gravity, and because the rigid body has been set to DISABLE_DEACTIVATION, but this does not seem to be the case. I was able to see this behavior in both 2.83.4 and 2.83.7.

Any hints would be appreciated. Thanks!
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Hinge constraint sticks to upper limit

Post by benelot »

Hello RedLagger,

I was trying to replicate the described effect but could not make it do that.

I made the proposed changes to the unmodified constraints demo of the newest release, which was compiled using DOUBLE_PRECISION, and I can not make it getting stuck at all.

Code: Select all

		doorTrans.setIdentity();
		doorTrans.setOrigin(btVector3(-5.0f, -2.0f, 0.0f));
		btRigidBody* pDoorBody = createRigidBody( 10.0, doorTrans, pDoorShape);
		pDoorBody->setActivationState(DISABLE_DEACTIVATION);
		const btVector3 btPivotA(10.f +  2.1f, -2.0f, 0.0f ); // right next to the door slightly outside
		btVector3 btAxisA( 0.0f, 0.0f, 1.0f ); // pointing upwards, aka Y-axis
Can you provide your exact example source code and see if double precision fixes the problem?
RedLagger
Posts: 4
Joined: Wed Mar 23, 2016 1:56 pm

Re: Hinge constraint sticks to upper limit

Post by RedLagger »

Thanks so much for looking into this benelot. Here is what I did this time:

- Downloaded the source from https://github.com/bulletphysics/bullet ... 2.83.7.zip.
- Built the project files using vs2010.bat. Opened the solution in MSVS 2010.
- Opened ConstraintsDemo.cpp, modified the door mass and axis exactly as shown in your code snippet.
- Built and ran the example browser (debug mode), then dragged the door to its upper limit and held it their until it stopped 'vibrating', then released the mouse and the door just stayed there.
- I added the DOUBLE_PRECISION pre-processor def in the example browser project and its various dependencies, rebuilt, but I was still able to re-create this issue.

Is there another source version I should experiment with? Also, it is important to note that the door has to be stable before releasing your mouse button. If you see it vibrating slightly, it does fall correctly when you release the mouse. You might have to try drag your mouse in different directions to get this to occur, but I am able to do it pretty easily.
Post Reply