SIMUV2: Added a "tire height" parameter to car XMLs.
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@918 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: c8a9aa13e4a20b67925e6a0acac1a49ac94f3255 Former-commit-id: 11458ffc3fb76634097634af1ef4d294a5a3f7ed
This commit is contained in:
parent
bffc9f919d
commit
e8994b3c6f
2 changed files with 11 additions and 3 deletions
|
@ -460,6 +460,7 @@ typedef struct CarElt
|
|||
#define PRM_MU "mu"
|
||||
#define PRM_RIMDIAM "rim diameter"
|
||||
#define PRM_TIREWIDTH "tire width"
|
||||
#define PRM_TIREHEIGHT "tire height"
|
||||
#define PRM_TIRERATIO "tire height-width ratio"
|
||||
#define PRM_RIDEHEIGHT "ride height"
|
||||
#define PRM_ROLLINGRESIST "rolling resistance"
|
||||
|
|
|
@ -30,12 +30,13 @@ SimWheelConfig(tCar *car, int index)
|
|||
void *hdle = car->params;
|
||||
tCarElt *carElt = car->carElt;
|
||||
tWheel *wheel = &(car->wheel[index]);
|
||||
tdble rimdiam, tirewidth, tireratio, pressure;
|
||||
tdble rimdiam, tirewidth, tireratio, pressure, tireheight;
|
||||
tdble x0, Ca, RFactor, EFactor, patchLen;
|
||||
|
||||
pressure = GfParmGetNum(hdle, WheelSect[index], PRM_PRESSURE, (char*)NULL, 275600);
|
||||
rimdiam = GfParmGetNum(hdle, WheelSect[index], PRM_RIMDIAM, (char*)NULL, 0.33f);
|
||||
tirewidth = GfParmGetNum(hdle, WheelSect[index], PRM_TIREWIDTH, (char*)NULL, 0.145f);
|
||||
tireheight = GfParmGetNum(hdle, WheelSect[index], PRM_TIREHEIGHT, (char*)NULL, -1.0f);
|
||||
tireratio = GfParmGetNum(hdle, WheelSect[index], PRM_TIRERATIO, (char*)NULL, 0.75f);
|
||||
wheel->mu = GfParmGetNum(hdle, WheelSect[index], PRM_MU, (char*)NULL, 1.0f);
|
||||
wheel->I = GfParmGetNum(hdle, WheelSect[index], PRM_INERTIA, (char*)NULL, 1.5f);
|
||||
|
@ -67,7 +68,10 @@ SimWheelConfig(tCar *car, int index)
|
|||
|
||||
patchLen = wheel->weight0 / (tirewidth * pressure);
|
||||
|
||||
wheel->radius = rimdiam / 2.0f + tirewidth * tireratio;
|
||||
if (tireheight > 0.0)
|
||||
wheel->radius = rimdiam / 2.0f + tireheight;
|
||||
else
|
||||
wheel->radius = rimdiam / 2.0f + tirewidth * tireratio;
|
||||
wheel->tireSpringRate = wheel->weight0 / (wheel->radius * (1.0f - cos(asin(patchLen / (2.0f * wheel->radius)))));
|
||||
wheel->relPos.x = wheel->staticPos.x = car->axle[index/2].xpos;
|
||||
wheel->relPos.y = wheel->staticPos.y;
|
||||
|
@ -80,7 +84,10 @@ SimWheelConfig(tCar *car, int index)
|
|||
SimBrakeConfig(hdle, BrkSect[index], &(wheel->brake));
|
||||
|
||||
carElt->_rimRadius(index) = rimdiam / 2.0f;
|
||||
carElt->_tireHeight(index) = tirewidth * tireratio;
|
||||
if (tireheight > 0.0)
|
||||
carElt->_tireHeight(index) = tireheight;
|
||||
else
|
||||
carElt->_tireHeight(index) = tirewidth * tireratio;
|
||||
carElt->_tireWidth(index) = tirewidth;
|
||||
carElt->_brakeDiskRadius(index) = wheel->brake.radius;
|
||||
carElt->_wheelRadius(index) = wheel->radius;
|
||||
|
|
Loading…
Reference in a new issue