forked from speed-dreams/speed-dreams-code
update simuv3/collide.cpp and differential.cpp with last commite on cvs torcs by Christos
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2425 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 66c482ee4d801e74edb6ac8d5d65f1c2f6eaf598 Former-commit-id: 10188f8b7075fb9699ab77d2ed9e3b3d83de1ddd
This commit is contained in:
parent
dbf79cbe09
commit
2b330312d3
2 changed files with 8 additions and 3 deletions
|
@ -690,7 +690,7 @@ SimCarCollideXYScene(tCar *car)
|
||||||
// TODO: SIGN, scrap value?
|
// TODO: SIGN, scrap value?
|
||||||
float rpsign = n[0]*rg[1] - n[1]*rg[0];
|
float rpsign = n[0]*rg[1] - n[1]*rg[0];
|
||||||
|
|
||||||
const float e = 1.0f; // energy restitution
|
const float e = 0.99f; // energy restitution
|
||||||
float j = -(1.0f + e) * sgScalarProductVec2(vp, n) / (car->Minv + rp * rp * car->Iinv.z);
|
float j = -(1.0f + e) * sgScalarProductVec2(vp, n) / (car->Minv + rp * rp * car->Iinv.z);
|
||||||
const float ROT_K = 0.5f;
|
const float ROT_K = 0.5f;
|
||||||
|
|
||||||
|
@ -898,7 +898,7 @@ static void SimCarCollideResponse(void * /*dummy*/, DtObjectRef obj1, DtObjectRe
|
||||||
car[i]->VelColl.az = car[i]->DynGCg.vel.az + js * rpsign[i] * rpn[i] * car[i]->Iinv.z * ROT_K;
|
car[i]->VelColl.az = car[i]->DynGCg.vel.az + js * rpsign[i] * rpn[i] * car[i]->Iinv.z * ROT_K;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float VELMAX = 1.0f;
|
static float VELMAX = 3.0f;
|
||||||
if (fabs(car[i]->VelColl.az) > VELMAX) {
|
if (fabs(car[i]->VelColl.az) > VELMAX) {
|
||||||
car[i]->VelColl.az = SIGN(car[i]->VelColl.az) * VELMAX;
|
car[i]->VelColl.az = SIGN(car[i]->VelColl.az) * VELMAX;
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,12 @@ SimDifferentialUpdate(tCar *car, tDifferential *differential, int first)
|
||||||
float delta_spin = spinVel1-spinVel0;
|
float delta_spin = spinVel1-spinVel0;
|
||||||
//float pressure = tanh(rate*delta_spin);
|
//float pressure = tanh(rate*delta_spin);
|
||||||
float pressure = rate;
|
float pressure = rate;
|
||||||
float bias = differential->dSlipMax * 0.5f* tanh(delta_spin);
|
float t_spin = tanh(delta_spin/differential->dSlipMax);
|
||||||
|
float bias = differential->dTqMax * 0.5f* t_spin;
|
||||||
|
if (fabs(2.0*bias) < differential->dTqMin)
|
||||||
|
{
|
||||||
|
bias = SIGN(bias) * 0.5 * differential->dTqMin;
|
||||||
|
}
|
||||||
float open = 1.0f - fabs(pressure);
|
float open = 1.0f - fabs(pressure);
|
||||||
//DrTq0 = DrTq*(0.5f + bias) + spiderTq;
|
//DrTq0 = DrTq*(0.5f + bias) + spiderTq;
|
||||||
//DrTq1 = DrTq*(0.5f - bias) - spiderTq;
|
//DrTq1 = DrTq*(0.5f - bias) - spiderTq;
|
||||||
|
|
Loading…
Reference in a new issue