- Update shadow's driver

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6773 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: d7c70e309e24230b2a7d90e9d91d9ad3c298bf35
Former-commit-id: a37977c6892f3bdb073059a878eede0fee8688b4
This commit is contained in:
torcs-ng 2019-11-20 00:10:43 +00:00
parent e43380e38c
commit 46bad99265
4 changed files with 34 additions and 2 deletions

View file

@ -810,6 +810,36 @@ void CarModel::configCar( void* hCar )
}
}
//===========================================================================
void CarModel::update( const tCarElt* car, const tSituation* sit )
{
Vec3d new_pos_g = Vec3d(car->pub.DynGCg.pos.x, car->pub.DynGCg.pos.y, car->pub.DynGCg.pos.z);
Vec3d new_vel_g = (new_pos_g - POS_G) / sit->deltaTime;
Vec3d new_acc_g = (new_vel_g - VEL_G) / sit->deltaTime;
POS_G = new_pos_g;
VEL_G = new_vel_g;
ACC_G = new_acc_g;
const sgMat4& m = car->pub.posMat;
VEL_L.x = VEL_G * Vec3d(m[0][0], m[0][1], m[0][2]);
VEL_L.y = VEL_G * Vec3d(m[1][0], m[1][1], m[1][2]);
VEL_L.z = VEL_G * Vec3d(m[2][0], m[2][1], m[2][2]);
ACC_L.x = ACC_G * Vec3d(m[0][0], m[0][1], m[0][2]);
ACC_L.y = ACC_G * Vec3d(m[1][0], m[1][1], m[1][2]);
ACC_L.z = ACC_G * Vec3d(m[2][0], m[2][1], m[2][2]);
double new_pos_az = car->pub.DynGCg.pos.az;
double new_vel_az = Utils::NormPiPi(new_pos_az - POS_AZ) / sit->deltaTime;
POS_AZ = new_pos_az;
VEL_AZ = new_vel_az;
updateWheels( car, sit );
}
double CarModel::AxleCalcMaxSpeed(double k, double kz, double kv, double trackMu, double trackRollAngle, double trackPitchAngle,
double gripScale, double tyreMu, double ax, double wx,double wf, double Cw,double Cg ) const
{

View file

@ -46,6 +46,7 @@ public:
void config( const tCarElt* car );
void config( void* hCar );
void update( const tCarElt* car, const tSituation* sit );
double CalcMaxSpeed(double k, double kz, double kv, double kFriction, double trackRollAngle, double trackPitchAngle) const;
double CalcBreaking( double k0, double kz0, double k1, double kz1, double spd1, double dist, double kFriction, double RollAngle, double TiltAngle ) const;

View file

@ -1512,6 +1512,7 @@ void TDriver::SpeedControl(int which, double targetSpd, double spd0, CarElt* car
void TDriver::Drive( tSituation* s )
{
m_cm.update( car, s );
DetectFlight();
if( m_raceStart || s->currentTime <= 0.5 )

View file

@ -865,8 +865,8 @@ void SDHUD::Refresh(tSituation *s, const SDFrameInfo* frameInfo,
//laptime
float currentPrevSectorSplitTime = currCar->_curSplitTime[currCar->_currentSector - 1]; // our time in the sector we have "just" run over
float bestPrevSectorSplitTime = currCar->_bestSplitTime[currCar->_currentSector-1]; // the best split time of the sector we are in this moment
//float currentPrevSectorSplitTime = currCar->_curSplitTime[currCar->_currentSector - 1]; // our time in the sector we have "just" run over
//float bestPrevSectorSplitTime = currCar->_bestSplitTime[currCar->_currentSector-1]; // the best split time of the sector we are in this moment
float bestSplitTime = currCar->_bestSplitTime[currCar->_currentSector]; // the best split time of the sector we are in this moment
float splitTimeDiff = 0;