Unstable Chain of Constraints

Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Unstable Chain of Constraints

Post by Mako_energy02 »

Another post, starting to feel bad. I have a scene that requires me to chain 17 constraints in an unusual way. I'm pretty much making a scale. I have the static body serving as the anchor for the whole thing. A hinge constraint connecting the horizontal bar holding up the trays. Another 8 point2point constraints connecting the horizontal bar to "unions", which are just bar shaped rigid bodies. At the end of each of the 8 unions have 8 more point2point constraints connecting to 2 trays (4 each, 1 in each corner of each tray).

When at rest, they are fine. When I put an object in one of the trays it behaves as it should at first, but just as it gets to the point where you'd think it would come to rest, a sudden jerking motion happens to the scale as a whole. At first I thought it was maybe a collision between the unions, since I have 2 unions in each corner of the horizontal bar...but I've disabled collision response, and even tried putting them in the same collision group and adjusted the collision mask appropriately. Then I thought maybe the constraints are just being unstable so I attempted to adjust the global ERP and CFM of the constraints to see if I could make them more stable. This didn't change anything. Setting bullet to a smaller simulation step size isn't really an option.

What else can I do to try and make this arrangement of constraints work?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Unstable Chain of Constraints

Post by Erwin Coumans »

The problem is likely larger mass ratios than the constraint solver can handle.
Setting bullet to a smaller simulation step size isn't really an option.
If you try this, will it improve the behavior?

Code: Select all

world->stepSimulation(dt,10,1./480.f);
Otherwise, did you try increasing the number of iterations for the solver?
Thanks,
Erwin
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Unstable Chain of Constraints

Post by Mako_energy02 »

The mass ratio's aren't too extreme, I don't think. The horizontal bar of the scale has a mass of 50, each union has a mass of 5, and each tray has a mass of 25. Let me know if there is something I'm missing.

I haven't tried adjusting the iterations for the solver yet, hadn't even occurred to me. I will try that next and either post the result or make an edit to this post. As for the simulation step, we have it setup to step by the previous frame time(but we also have it capped at 60FPS, so it's usually just being stepped by 16.6ms). I could re-write that as just a test, but that wouldn't be a long term solution for me.

Edit: Quadrupling the default value for the number of iterations on the solver seems to have made it slightly more stable, but not much.
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Unstable Chain of Constraints

Post by Mako_energy02 »

I've done some more testing and increasing the number of iterations for the solver by x10 the default value provided no more noticeable effect then increasing the default value by x4. The issue still persists.

I also looked into the possibility of the mass ratio's being too extreme. I tinkered with a number of mass configurations for all the pieces of the scale and I couldn't really see any change in the behavior.

Still open to suggestions if anyone has any. Would be greatly appreciated.