What does setSleepingConstantThreshold(linear, angular) do?

Post Reply
Manish Bista
Posts: 6
Joined: Wed Feb 11, 2015 2:04 am

What does setSleepingConstantThreshold(linear, angular) do?

Post by Manish Bista »

I am currently trying to make a Ragdoll and it falls to the ground obeying constraints as expected but it never actually comes to rest. The rigid bodies appear to vibrate and the Ragdoll starts moving around with back-flips and such. I searched for the solution to this problem a lot, and found out that many people have had this problem, yet I couldn`t find a solution. I started tweaking in some values in the code given below:

Code: Select all

m_bodies[i]->setDamping(0.05, 0.85);
		m_bodies[i]->setDeactivationTime(3.0);
		m_bodies[i]->setSleepingThresholds(5.4, 5.6);
		m_bodies[i]->setContactProcessingThreshold(0.25f);
		m_bodies[i]->setCcdMotionThreshold(0.05f);
		m_bodies[i]->setCcdSweptSphereRadius(0.06f);
To be honest, I don`t still know what some of these functions do. I changed the arguments of setSleepingThresholds(linear, angular), which for some given value seems to put the body to rest. I guessed that the body will be put to sleep if the current values exceed the threshold values. However, when I get the threshold values for any time, all of them are 1(constant). They don`t actually change at all, then what`s the point in setting up a threshold. So, I need to find what the parameters are and what the function does. Also, if there is solution or optimization to the problem of Ragdoll that I explained earlier, please share.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: What does setSleepingConstantThreshold(linear, angular)

Post by drleviathan »

I believe setDeactivationTime(t) and setSleepingThresholds(v, w) go together. If an object's linear and angular velocity magnitudes are less than v and w respectively for a period of t seconds then the simulation will try to deactivate it.

I have had some experience with the unstable ragdoll problem. I found that a ragdoll with more than 11 bones would be unstable. I tried a few things: atificially large inertia tensors for the smaller pieces and extra friction and damping which didn't help as I recall. However, I did not experiment with smaller timesteps and I've since heard that small timesteps are often required for stability of dynamically controlled character animation so it would probably help for ragdoll stability.

I implemented a stable driven character with more pieces using verlet relaxation andposted about it elsewhere on these forums.

Finally, there is the possibility of using Bullet's multi-body simulation instead of a collection of RigidBodies and Constraints, but I haven't had experience working with it yet.
Post Reply