Torsional Spring

meclory
Posts: 12
Joined: Wed Jun 18, 2008 4:29 pm

Torsional Spring

Post by meclory »

Hi,

I'm trying to implement "torsional spring" for my simulation(It's a scientific simulation). I believe that I can use btHingeConstraint and its member functions to implement it. More specifically, I mean "enableAngularMotor" member function.

Code: Select all

void btHingeConstraint::enableAngularMotor(bool enableMotor, btScalar targetVelocity, btScalar maxMotorImpulse)
From Demos and posts in this forum, it seems that Bullet can only control "targetVelocity" parameter. Then I guess that "maxMotorImpulse" just means the motor's adaptive speed to reach the "targetVelocity". But we need a direct force(or torque) control to get physically correct torsional spring(in proportion to the amount of deformation).

Is there a good way to implement torsional springs in Bullet?
meclory
Posts: 12
Joined: Wed Jun 18, 2008 4:29 pm

Re: Torsional Spring

Post by meclory »

Now I managed to make a "spring" effect without using AngularMotor. I used the member function "setLimit". I set the 5 parameters of "setLimit" such as:

btScalar low(-0.01f);
btScalar high(0.01f);
btScalar softness(1.f);
btScalar biasfactor(1.f);
btScalar relaxation(1.f);

But my system is not in static equilibrium, so I intend to study the five parameters more deeply. Would you please give me any suggestion or explanation?

*EDIT*

There were already some nice posts when we put "softness" and "relaxation" in the search window.