Spring ignoring damping

User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

Spring ignoring damping

Post by Dragonlord »

Got the update now working with some hacking and added the spring constraints as I planed. So far it works except damping. I placed two collision objects in the world one below the other ( upper static ) and some distance. They are connected by a generic 6dof spring constraint. The spring is set along the linear z axis and the code looks like this:

generic6Dof->setStiffness( 2, linearSpringStiffness.z );
generic6Dof->setDamping( 2, springDamping );
generic6Dof->enableSpring( 2, true );

Whereas linearSpringStiffness.z has a value of 40.0f and springDamping 0.5f . These values more of less correspond to the values in the collision demo in bullet. The lower object does swing up and down as it should but the period never gets smaller. Is there anything you have to set in addition for the damping to work? As it stands now it's totally ignored.
User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

Re: Spring ignoring damping

Post by Dragonlord »

Played around with the values a bit and figured out that the damping is actually working but with very low values. With a damping of 0.5 nothing happened. I had to use a damping of like 0.01 to get a damping effect ( although a strong one ).

What kind of law is the damping in Bullet actually based on? I noticed the following line in the generic spring constraint:

Code: Select all

btScalar velFactor = info->fps * m_springDamping[i] / btScalar(info->m_numIterations);
m_linearLimits.m_targetVelocity[i] =  velFactor * force;
Hence the damping seems to be correlated with the framerate. Is the info->fps equal to 60 ( from the 60Hz simulation used by Bullet )? As then 0.01*60 would be 0.6 which is close to what I expected to be used in the first place.