diff --git a/src/modules/simu/simuv4/susp.h b/src/modules/simu/simuv4/susp.h index e81bfffd2..40bf204eb 100644 --- a/src/modules/simu/simuv4/susp.h +++ b/src/modules/simu/simuv4/susp.h @@ -56,9 +56,10 @@ typedef struct Suspension tdble force; /* generated force */ int state; /* indicate the state of the suspension */ + /* Note: susp.state is merged with wheel.state in the code, + * so SIM_SUSP and SIM_WH states cannot use the same bit */ #define SIM_SUSP_COMP 1 /* the suspension is fully compressed */ #define SIM_SUSP_EXT 2 /* the suspension is fully extended */ -#define SIM_SUSP_INAIR 4 /* the suspension is in the air, can be combined with the other states */ } tSuspension; diff --git a/src/modules/simu/simuv4/wheel.cpp b/src/modules/simu/simuv4/wheel.cpp index a87d118bc..332ff18dd 100644 --- a/src/modules/simu/simuv4/wheel.cpp +++ b/src/modules/simu/simuv4/wheel.cpp @@ -43,6 +43,7 @@ SimWheelConfig(tCar *car, int index) 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); + //BUG: the next line should go after SimBrakeConfig to have an effect wheel->I += wheel->brake.I; // add brake inertia wheel->staticPos.y = GfParmGetNum(hdle, WheelSect[index], PRM_YPOS, (char*)NULL, 0.0f); x0 = GfParmGetNum(hdle, WheelSect[index], PRM_RIDEHEIGHT, (char*)NULL, 0.20f); @@ -162,7 +163,7 @@ void SimWheelUpdateRide(tCar *car, int index) if (car->features & FEAT_FIXEDWHEELFORCE) { if (max_extend > new_susp_x + 0.01) { - wheel->susp.state = SIM_SUSP_INAIR; + wheel->susp.state = SIM_WH_INAIR; } else {wheel->susp.state = 0;} } else { wheel->susp.state = 0; @@ -222,7 +223,7 @@ void SimWheelUpdateForce(tCar *car, int index) SimSuspUpdate(&(wheel->susp)); // check suspension state wheel->state |= wheel->susp.state; - if ( ((wheel->state & SIM_SUSP_EXT) == 0) && ((wheel->state & SIM_SUSP_INAIR) == 0) ) { + if ( ((wheel->state & SIM_SUSP_EXT) == 0) && ((wheel->state & SIM_WH_INAIR) == 0) ) { wheel->forces.z = axleFz + wheel->susp.force + wheel->axleFz3rd; reaction_force = wheel->forces.z; if (car->features & FEAT_FIXEDWHEELFORCE) { diff --git a/src/modules/simu/simuv4/wheel.h b/src/modules/simu/simuv4/wheel.h index 5338102a1..b083845ce 100644 --- a/src/modules/simu/simuv4/wheel.h +++ b/src/modules/simu/simuv4/wheel.h @@ -47,6 +47,7 @@ typedef struct /* 1 and 2 are for suspension state */ #define SIM_WH_SPINNING 4 /* the wheel is spinning */ #define SIM_WH_LOCKED 8 /* the wheel is locked */ +#define SIM_WH_INAIR 16 /* the wheel is in the air */ tdble axleFz; /* force from axle (anti-roll bar) */ tdble axleFz3rd; /* force from axle (3rd/heave spring) */ tTrkLocPos trkPos; /* current track position */