forked from speed-dreams/speed-dreams-code
New function for "power steering"
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6445 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: a8be7be20051f0d38dc768d6ac504d0f71b2dadc Former-commit-id: 1a8cffb621925fe9c5597c1114060aaac9ea609c
This commit is contained in:
parent
8038ccb05b
commit
58106555e8
1 changed files with 8 additions and 4 deletions
|
@ -209,9 +209,13 @@ int ForceFeedbackManager::autocenterEffect(tCarElt* car, tSituation *s){
|
|||
|
||||
int effectForce;
|
||||
int sign;
|
||||
tdble TqAlign;
|
||||
|
||||
//force acting on the front wheels
|
||||
effectForce = car->_steerTqAlign * this->effectsConfig["autocenterEffect"]["frontwheelsmultiplier"] / 1000;
|
||||
tdble H = 450.0;
|
||||
TqAlign = car->_steerTqAlign;
|
||||
TqAlign = H * TqAlign / (fabs(TqAlign) + H);
|
||||
effectForce = TqAlign * this->effectsConfig["autocenterEffect"]["frontwheelsmultiplier"] / 1000;
|
||||
|
||||
//force action on the back wheels
|
||||
effectForce += car->_wheelFy(REAR_RGT) * this->effectsConfig["autocenterEffect"]["rearwheelsmultiplier"] / 1000 ;
|
||||
|
@ -227,11 +231,11 @@ int ForceFeedbackManager::autocenterEffect(tCarElt* car, tSituation *s){
|
|||
sign = (effectForce > 0) - (effectForce < 0);
|
||||
|
||||
//be sure this is a positive number
|
||||
effectForce = effectForce * sign;
|
||||
//effectForce = effectForce * sign;
|
||||
|
||||
//we use an inverse exponential function to have a stronger force at low values and a lighetr one a bigger values
|
||||
effectForce = (int)((pow((double) effectForce, (double) 1/2) * 120) * sign);
|
||||
|
||||
//effectForce = (int)((pow((double) effectForce, (double) 1/2) * 120) * sign);
|
||||
|
||||
return effectForce;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue