simuv2 bug update

Brian Martin <[email protected]>
Newsgroups gmane.games.torcs.general
Message-ID <[email protected]>
I have done a lot of testing since my last post. Two cars will behave
unnaturally when they become air-born. The cars will stand up on one
or two wheels and slowly settle on the track. The cars will then drive
normally. Again, this  problem occurs with  a combination  of low mass
and high spring pressure.

This  code  change will solve the problem:

In wheel.cpp:

void SimWheelUpdateRide(tCar *car, int index)
{
    tWheel *wheel = &(car->wheel[index]);
    tdble Zroad;

    // compute suspension travel
    RtTrackGlobal2Local(car->trkPos.seg, wheel->pos.x, wheel->pos.y, 
&(wheel->trkPos), TR_LPOS_SEGMENT);
    wheel->zRoad = Zroad = RtTrackHeightL(&(wheel->trkPos));


    // Wheel susp.x is not the wheel movement, look at SimSuspCheckIn, 
it becomes there scaled with
    // susp->spring.bellcrank, so we invert this here.
    //tdble prexwheel = wheel->susp.x / wheel->susp.spring.bellcrank;

    // unreliable value tdble new_susp_x= prexwheel - wheel->rel_vel * 
SimDeltaTime;


        tdble max_extend =  wheel->pos.z - Zroad;
    wheel->rideHeight = max_extend;

//////////////////////test///////////////////
    tdble prex = wheel->susp.x;
//////////////////////////////////////////////////


    if (max_extend < wheel->susp.x) {
        wheel->susp.x = max_extend;
        wheel->rel_vel = 0.0f;
    } else if (wheel->susp.x < wheel->susp.spring.packers) {
        //////////////test (fixes elevated car at race start for most 
cars)///
        wheel->susp.x = wheel->susp.spring.packers;
        /////////////////////////////////////////////////////
        wheel->rel_vel = 0.0f;
    ///////////////test fixes all mispositioned car problems/////       
    }else{
        //wheel->susp.x = new_susp_x;
        wheel->susp.x = wheel->pos.z - Zroad;
    }
    //////////////////////////////////////////////////////////////
 
//    tdble prex = wheel->susp.x;


//    wheel->susp.x = new_susp_x;


    // verify the suspension travel, beware, wheel->susp.x will be 
scaled by SimSuspCheckIn
    SimSuspCheckIn(&(wheel->susp));
    wheel->susp.v = (prex - wheel->susp.x) / SimDeltaTime;
   
    // update wheel brake
    SimBrakeUpdate(car, wheel, &(wheel->brake));

}

This code will also solve the problem of simuv going berzerk with huge 
damper rebound values.

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.