Unstable rotational limits

Please don't post Bullet support questions here, use the above forums instead.
smaker
Posts: 16
Joined: Mon Sep 03, 2007 5:09 pm

Re: Unstable rotational limits

Post by smaker »

Yes, with your code all is actually same, I need to take atan2f negative too. I'll try to look, what is this strange thing..
I can use -atan2f(u2 dot v1, u2 dot u1) or equivalent atan2f(v2 dot u1, v2 dot v1) with positive sign.
Iterative solver is PGS (and, optionally, SOR; but now overrelaxation value is 1.05 to avoid large energy gains, with value 1.0 and pure PGS solver jittering also happens). Common number of iterations is 15, and it handles quite stable stack of boxes (typically called 'pyramid' but it more for triangle) with base line of 30 OBBs (next line 29, 28, ..., 1). Caching used only for contact joints. For other joints caching is turned off because on stress scenes (chain of 1500 boll-socketed spheres) caching brings even more jittering than initial guess set to 0.0.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Unstable rotational limits

Post by Dirk Gregorius »

The jittering in the long chains/trees is beacuse of the (non-linear) Baumgarte stabilization, but you shouldn't see jitter for ragdolls. Personally I wouldn't use SOR at all. Maybe look at Bullet's ragdoll example and grap the ragdoll at a foot. Does this jitter as well?

Just to make this sure. Do you clamp the (accumulated) impulses or lambda for the limits correctly (as you do for contacts)? Also note that depending on how you define the constraints (either C >= 0 or C <= 0) the max lambda can be different for the lower and upper limit ( e.g. lambda <= 0 or lambda >= 0 )
smaker
Posts: 16
Joined: Mon Sep 03, 2007 5:09 pm

Re: Unstable rotational limits

Post by smaker »

Yep, lambdas clamped as they should.
SOR helps a bit in pyramid scene because 15 iterations for such massive scene is small and relaxation value of 1.05-1.1 helps solver converge a bit faster and makes whole scene more stable (not much actually, but it does); maybe for single ragdolls it's not so important, but I think that overrelaxation of 1.05 will not add much energy, especially on 15 iterations.
Bullet's ragdoll demo is quite strange. Ragdoll's jittering too, and in the air quite strong I must say. Even if it falls to floor, legs are jittering a bit. And when I grasp doll's foot, as it hang in the air, doll is "dancing".
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Unstable rotational limits

Post by Dirk Gregorius »

So you should consider that you have a correct solver. Sorry, I would compare this with my own stuff, but I am currently cleaning up and have nothing that really works. The only final advice that comes into my mind are the masses. I would try equal masses (e.g. 10 kg) for all bodies first and then try making masses lighter when moving outward from the pelvis (e.g. toward the hand). Additionally I would (artifically) scale the inertia. Maybe all bodies with a factor of 4 and the shouldes a little more, say a factor of 8 ~ 16. Play around with it a little and see if this helps...


Cheers,
-Dirk
smaker
Posts: 16
Joined: Mon Sep 03, 2007 5:09 pm

Re: Unstable rotational limits

Post by smaker »

Ok, huge thanks to you for the productive discussion!
I'll try to play with masses and inertias, also, I'll inspect whole doll configuration (maybe parts of doll when collide cause some problems to solver or something)
Anyway, I'm a little bit undisturbed now, ater I have seen bullet demo. Seems like this is trouble to most physics engines, and I assume that freeze(sleep) will save me from that problem.
I repeat that strong jittering appears only in massive scene like 20 ragdolls falling on each other, with different obstacles and etc, so I think I can just admit it.