[SOLVED] Constrained box shapes experience heavy twitching

benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland

[SOLVED] Constrained box shapes experience heavy twitching

Post by benelot »

I am creating "randomly' connected boxes which are constrained by btGeneric6DoFConstraints. By randomly is meant that the connections are random, but the constraint definition is not. So when I have two boxes that are said to be connected, I position the first cube, then I calculate the position where the joint will be, from there I calculate the other cube position. Then I have a location on both boxes where they are connected and what direction the joint looks. So I set the constraint accordingly. I know it could be that the constraints I set are contradicting and that causes the twitching in the solver. But I even have examples where the there are only two boxes and one constraint, they fall onto the btStaticPlaneShape that I use as a ground and the constraint seems not to be possible to be resolved.

What could be the issue here?
Last edited by benelot on Tue Aug 18, 2015 1:36 pm, edited 1 time in total.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Constrained box shapes experience heavy twitching

Post by drleviathan »

Are the boxes colliding with each other? In this recent thread we learned that the two constrained objects will collide by default so if your boxes overlap then the constraint may be unresolvable.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland

Re: Constrained box shapes experience heavy twitching

Post by benelot »

Hi,

No I checked whether I left the default value there, but it is set to true (Disable collision). I found that my problem is exactly the same as this one here:
"btGeneric6DofSpring2Constraint blows up for kinematic rotate"
http://bulletphysics.org/Bullet/phpBB3/ ... =9&t=10410

It seems that it is a problem with the Spring2 constraint itself. I will help to fix it in that thread.Thanks for your help.

Edit: It was mainly not the problem mentioned in the thread mentioned above. It was mainly the fact that when you connect elements with each other via constraints, it might be that they are overlapping with constrained bodies that are nearby.
Consider this problem: [ ]--[ ]--[ ] (Three boxes connected by two constraints)
Now imagine that both the left and right boxes are pulled into the the middle one by the constraints because of their definition. That causes huge repelling forces. And so it did until I turned off collisions among all connected boxes via the collision masks. Then they were perfectly quiet in nearly all cases.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland

Re: Constrained box shapes experience heavy twitching

Post by benelot »

I fixed my problem by looking at the penetration depth between all boxes as I described here:

http://www.bulletphysics.org/Bullet/php ... =9&t=10741

By that I could find out that some of the boxes were still interpenetrating strongly and therefore were resolving, because the interpenetration is not yet solved.