forked from speed-dreams/speed-dreams-code
Force Feedback: adjust autocenter force calculation
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6423 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 24bee40ae8a16cacb8c2bb51dfb8f973c7c268f4 Former-commit-id: fff94e4459e07d7a894735958fbcc50ca483f1fc
This commit is contained in:
parent
1a8897cbbc
commit
88da81d3a3
1 changed files with 7 additions and 0 deletions
|
@ -217,6 +217,7 @@ int ForceFeedbackManager::autocenterEffect(tCarElt* car, tSituation *s){
|
||||||
|
|
||||||
|
|
||||||
int effectForce;
|
int effectForce;
|
||||||
|
int sign;
|
||||||
|
|
||||||
//force acting on the front wheels
|
//force acting on the front wheels
|
||||||
effectForce = car->_steerTq * this->effectsConfig["autocenterEffect"]["frontwheelsmultiplier"] / 1000;
|
effectForce = car->_steerTq * this->effectsConfig["autocenterEffect"]["frontwheelsmultiplier"] / 1000;
|
||||||
|
@ -225,6 +226,7 @@ int ForceFeedbackManager::autocenterEffect(tCarElt* car, tSituation *s){
|
||||||
effectForce += -1 * car->_wheelFy(REAR_RGT) * this->effectsConfig["autocenterEffect"]["rearwheelsmultiplier"] / 1000 ;
|
effectForce += -1 * car->_wheelFy(REAR_RGT) * this->effectsConfig["autocenterEffect"]["rearwheelsmultiplier"] / 1000 ;
|
||||||
effectForce += -1 * car->_wheelFy(REAR_LFT) * this->effectsConfig["autocenterEffect"]["rearwheelsmultiplier"] / 1000;
|
effectForce += -1 * car->_wheelFy(REAR_LFT) * this->effectsConfig["autocenterEffect"]["rearwheelsmultiplier"] / 1000;
|
||||||
|
|
||||||
|
|
||||||
//smooth
|
//smooth
|
||||||
effectForce = (effectForce + (this->effectsConfig["autocenterEffect"]["previousValue"] * this->effectsConfig["autocenterEffect"]["smoothing"] / 1000)) / ((this->effectsConfig["autocenterEffect"]["smoothing"]/1000)+1);
|
effectForce = (effectForce + (this->effectsConfig["autocenterEffect"]["previousValue"] * this->effectsConfig["autocenterEffect"]["smoothing"] / 1000)) / ((this->effectsConfig["autocenterEffect"]["smoothing"]/1000)+1);
|
||||||
// GfLogInfo("Autocenter smooth: (%i)\n", effectForce);
|
// GfLogInfo("Autocenter smooth: (%i)\n", effectForce);
|
||||||
|
@ -233,6 +235,11 @@ int ForceFeedbackManager::autocenterEffect(tCarElt* car, tSituation *s){
|
||||||
this->effectsConfig["autocenterEffect"]["previousValue"] = effectForce;
|
this->effectsConfig["autocenterEffect"]["previousValue"] = effectForce;
|
||||||
|
|
||||||
// GfLogInfo("Autocenter: (%i)\n", effectForce);
|
// GfLogInfo("Autocenter: (%i)\n", effectForce);
|
||||||
|
sign = (effectForce > 0) - (effectForce < 0);
|
||||||
|
//be sure this is a positive number
|
||||||
|
effectForce = effectForce * sign;
|
||||||
|
|
||||||
|
effectForce = (int)((pow((double) effectForce, (double) 1/2) * 120) * sign);
|
||||||
|
|
||||||
return effectForce;
|
return effectForce;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue