New 6DOF Spring2 constraint spring limiting issue. Bug?
Posted: Fri May 08, 2015 11:27 pm
Around line 788 of btGeneric6DofSpring2Constraint is the following code.
I believe this is incorrect, but I still have problems even if it is corrected. My understanding of this line is that if the angular frequency times the dt (the full step time, not the substep ) is greater than 0.25, then it limits ks to be a the spring frequency that will be 0.25.
Angular freq is defined as:
The problem is solving for ks in the previous equations yields
0.25 squared is the same as 1/16, so
Note the *m not /m. This seems to yield the intended result, however, I would also argue that the value should be based on the substep, not the full step, Furthermore, since it caps the spring all the time, it will yield incorrect results, which is what was happening to me, since I have sprung mass vehicle. I had to increase the step time just to make the vehicle not collapse on the bump stops.
I understand that means the vehicle may not have been stable, but since it uses the full step time and not the substep, I think this is probably incorrect as it does run stably if I disable this code.
Code: Select all
//limit stiffness (the spring should not be sampled faster that the quarter of its angular frequency)
if( 0.25 < angularfreq * dt)
{
ks = BT_ONE / dt / dt / btScalar(16.0) / m;
}
Angular freq is defined as:
Code: Select all
btScalar m = mA > mB ? mB : mA;
...
btScalar angularfreq = sqrt(ks / m);
Code: Select all
ks = (0.25 * 0.25) / dt / dt * m;
Code: Select all
ks = BT_ONE / dt / dt / btScalar(16.0) * m;
I understand that means the vehicle may not have been stable, but since it uses the full step time and not the substep, I think this is probably incorrect as it does run stably if I disable this code.