31 tdble rimdiam, tireratio, pressure;
32 tdble x0, Ca, RFactor, EFactor, patchLen;
61 RFactor =
MIN(1.0f, RFactor);
62 RFactor =
MAX(0.1f, RFactor);
63 EFactor =
MIN(1.0f, EFactor);
81 carElt->_rimRadius(index) = rimdiam / 2.0f;
82 carElt->_tireHeight(index) = wheel->
tirewidth * tireratio;
83 carElt->_tireWidth(index) = wheel->
tirewidth;
84 carElt->_brakeDiskRadius(index) = wheel->
brake.
radius;
85 carElt->_wheelRadius(index) = wheel->
radius;
87 wheel->
mfC = 2.0f - asin(RFactor) * 2.0f /
PI;
88 wheel->
mfB = Ca / wheel->
mfC;
108 const tdble rubberDensity = 930.0f;
113 GfError(
"Wheel mass minus tire tread mass minus rim mass is smaller than 0.0kg, setting it to 3.0 kg");
117 tdble innerRadius = rimdiam / 2.0f;
122 tdble temperature = 273.15f + 20.0f;
124 tdble nitrogenR = 296.8f;
185 if (max_extend < new_susp_x) {
186 new_susp_x = max_extend;
188 }
else if (new_susp_x < wheel->susp.spring.packers) {
193 if (new_susp_x < max_extend) {
198 wheel->
susp.
x = new_susp_x;
215 tdble vt, v, v2, wrl;
270 }
else if (v < 0.000001f) {
274 sx = (vt - wrl) / fabs(vt);
280 s = sqrt(sx*sx+sy*sy);
285 car->
carElt->_skid[index] = 0.0f;
287 car->
carElt->_skid[index] =
MIN(1.0f, (s*zforce*0.0002f));
295 camberDelta = -casterCamber;
298 camberDelta = casterCamber;
304 Bx = wheel->
mfB * stmp;
313 tdble otherSurfaceContribution = 0.0f;
326 if (otherSurface != NULL && otherSurfaceContribution > 0.0f) {
327 surfaceFriction = surfaceFriction*(1.0f - otherSurfaceContribution) + otherSurface->
surface->
kFriction*otherSurfaceContribution;
328 rollRes = rollRes*(1.0f - otherSurfaceContribution) + otherSurface->
surface->
kRollRes*otherSurfaceContribution;
336 F *= zforce * mu * surfaceFriction * (1.0f + 0.05f * sin((-wheel->
staticPos.
ax + camberDelta) * 18.0f));
339 wheel->
rollRes = zforce * rollRes;
353 wheel->
forces.
x = Ft * CosA - Fn * SinA;
354 wheel->
forces.
y = Ft * SinA + Fn * CosA;
366 car->
carElt->_wheelSlipSide(index) = sy*v;
367 car->
carElt->_wheelSlipAccel(index) = sx*v;
368 car->
carElt->_reaction[index] = zforce;
378 for (i = 0; i < 4; i++) {
379 wheel = &(car->
wheel[i]);
400 for (i = axlenb * 2; i < axlenb * 2 + 2; i++) {
401 wheel = &(car->
wheel[i]);
403 I = wheel->
I + car->
axle[axlenb].
I / 2.0f;
411 if (fabs(ndot) > fabs(wheel->
spinVel)) {
449 tdble deltaEnergy = energyGain - energyLoss;
464 tdble cpRubber = 2009.0f - 1.962f*tireCelsius + 3.077f*tireCelsius*tireCelsius/100.0f;
471 const tdble cvNitrogen = 1041.0f - 296.8f;
472 tdble heatCapacity = cpRubber * actualRubberMass + cvNitrogen * wheel->
tireGasMass;
487 if (deltaGraining > 0.0f) {
#define PRM_TREADTHICKNESS
tdble toRight
Distance (+ to left, - to right) relative to the right side of segment.
void SimWheelConfig(tCar *car, int index)
void SimWheelUpdateTire(tCar *car, int index)
tdble otherSurfaceContribution[4]
static const char * SuspSect[4]
bool SimAdjustPitCarSetupParam(tCarPitSetupValue *v)
#define SECT_FRNTLFTWHEEL
#define SIGN(x)
Sign of the expression.
void SimBrakeUpdate(tCar *car, tWheel *wheel, tBrake *brake)
void SimSuspConfig(void *hdle, const char *section, tSuspension *susp, tdble F0, tdble X0)
#define SECT_REARRGTWHEEL
void SimSuspUpdate(tSuspension *susp)
#define SECT_FRNTLFTBRAKE
tdble tireConvectionSurface
void SimSuspReConfig(tCar *car, int index, tSuspension *susp, tdble F0, tdble X0)
tdble ay
angle along y axis
#define SECT_FRNTRGTWHEEL
#define SECT_REARLFTWHEEL
#define SECT_REARLFTBRAKE
void SimWheelUpdateRotation(tCar *car)
static const char * WheelSect[4]
static const char * BrkSect[4]
tWheelSpec wheel[4]
Wheels specifications.
tdble rollRes
rolling resistance, useful for sound
tTrackSeg * otherSurfaceSeg[4]
tdble toLeft
Distance (- to left, + to right) relative to left side of segment.
float tdble
Floating point type used in TORCS.
tCarPitSetupValue wheelrideheight[4]
#define SECT_REARRGTBRAKE
tCarPitSetupValue wheelcamber[4]
#define SECT_FRNTRGTBRAKE
void SimSuspCheckIn(tSuspension *susp)
tdble kRollRes
Rolling resistance.
tTrackSeg * seg
Track segment.
tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle.
Track segment (tTrackSeg) The segments can be straights (type TR_STR): (the track goes from the right...
tdble az
angle along z axis
void SimWheelReConfig(tCar *car, int index)
void SimUpdateFreeWheels(tCar *car, int axlenb)
tTrackSurface * surface
Segment surface.
#define TR_LPOS_SEGMENT
Relative to the segment which the point is located, including border and sides, mostly used for conta...
tdble ax
angle along x axis
#define NORM_PI_PI(x)
Angle normalization between -PI and PI.
void SimWheelUpdateRide(tCar *car, int index)
void SimWheelUpdateForce(tCar *car, int index)
int skillLevel
Driver's skill level (0=rookie -> 3=pro)
tCarPitSetupValue wheelcaster[4]
tdble kFriction
Coefficient of friction.
tCarPitSetupValue wheeltoe[4]
void SimBrakeConfig(void *hdle, const char *section, tBrake *brake)
void SimWheelResetWear(tCar *car, int index)