Real car drive

Toby

05-12-2008 08:11:58

Hello,

I would to know if someone manage to set properly car suspension, tire function.

My tire function is not ok. Car slips to much or not at all. And when I take a curve and if a bounce occur then often car stop is lateral movement instead of slipping.

I use NxOgre bleeding and its wheelset. I create a Motor class that modify engine rpm and wheel rpm according to acceleration and gearbox.

This is my param:


//collision box
cubeshape.X=3.0
cubeshape.Y=0.9
cubeshape.Z=6.1

mass=3000
density=0
maxBrakeForce=300
//turbo = acceleration x 2
acceleration=100
massPosition.X=0.0
massPosition.Y=-1.16
massPosition.Z=0.2

// Wheel
LeftFrontWheelPosition.X=1.2
LeftFrontWheelPosition.Y=-0.7
LeftFrontWheelPosition.Z=2.2

LeftBackWheelPosition.X=-1.2
LeftBackWheelPosition.Y=-0.7
LeftBackWheelPosition.Z=-1.8

// diamètre de roue
radius=0.45
// pression de l'amortisseur (dureté)
spring=1000.0
damper=0.2
targetValue=1.0
// débattement de l'amortisseur
suspensionTravel=0.2

//value
//| extremum
//| _
//| / \
//| / \_asymptote
//| _/
//|______________ Slip
//
// Fonction de calcul du grip

// valeur pour le grip longitudinal (vers l'avant ou l'arrière)
lngExtremumSlip=0.0
lngExtremumValue=0.05
lngAsymptoteSlip=5.0
lngAsymptoteValue=0.01
// facteur de grip (jouer la dessus pour le grip)
lngStiffnessFactor=800000

// valeur pour le grip lateral
latExtremumSlip=0.0
latExtremumValue=0.02 //16
latAsymptoteSlip=5.0
latAsymptoteValue=0.001
latStiffnessFactor=800000


// Etagement de la boite de vitesse
// Plus la valeur est élevé, plus la force moteur est démultiplié.
// x1 > x2 > ... > xn
gearBox.0 = 10
gearBox.1 = 4.0 //4.0
gearBox.2 = 3.0 //3.0
gearBox.3 = 2.1 //1.8
gearBox.4 = 1.5 //1.2
gearBox.5 = 1.0
gearBox.6 = 0.8


tire function value is not academic but before I tried value like it whitout success:

// valeur pour le grip lateral
latExtremumSlip=2.0
latExtremumValue=0.02 //16
latAsymptoteSlip=5.0
latAsymptoteValue=0.001
latStiffnessFactor=800000


Before with NxOgre 0.9 I use wheel flag NX_WF_INPUT_LAT_SLIPVELOCITY | NX_WF_INPUT_LNG_SLIPVELOCITY but now it is a weird.

Another method I used is at each frame to modify manually stiffnessfactor(this is the same thing that use wheel flag i compute stiffness according to lat velocity and longitudinal velocity)

mWheelFriction.latTFD.stiffnessFactor = mWheelFriction.latDyn - (mWheelFriction.latDyn*fabs(contactData.lateralImpulse));///(1+100*_time);
mWheelFriction.lngTFD.stiffnessFactor = mWheelFriction.lngDyn - (mWheelFriction.lngDyn*fabs(contactData.longitudalImpulse));///(1+100*_time);

// clamp the values to dynamic stiffness
if( mWheelFriction.latTFD.stiffnessFactor < mWheelFriction.latDynMin )
mWheelFriction.latTFD.stiffnessFactor = mWheelFriction.latDynMin;
if( mWheelFriction.lngTFD.stiffnessFactor < mWheelFriction.lngDynMin )
mWheelFriction.lngTFD.stiffnessFactor = mWheelFriction.lngDynMin;

shape->setLateralTireForceFunction(mWheelFriction.latTFD);
shape->setLongitudalTireForceFunction(mWheelFriction.lngTFD);


Any idea to make my dreams come true?

NickM

11-12-2008 06:43:55

Hi Toby, I've spent quite a few hours trying to get the tyre model working something like a real tyre should and I'm still not that happy with it really, it's currently the best that I've had it though, I'm still using NxOgre 0.9 but here's what I'm doing...


lateralTireFunctionDesc = w->getLateralTireForceFunction();
lateralTireFunctionDesc.stiffnessFactor = wcd.contactForce;

//Clamp the stiffness.
if(lateralTireFunctionDesc.stiffnessFactor > maximum_lateral_stiffnessFactor) lateralTireFunctionDesc.stiffnessFactor = maximum_lateral_stiffnessFactor;

if(abs(wcd.longitudalSlip) > 0.1){
lateralTireFunctionDesc.stiffnessFactor *= 0.4;
}

//Params.
lateral_tire_extremumSlip = 0.05;
lateral_tire_extremumValue = 0.1;
lateral_tire_asymptoteSlip = 0.1;
lateral_tire_asymptoteValue = 0.05;
lateral_tire_stiffnessFactor = 2000.0;
maximum_lateral_stiffnessFactor = 2200.0;
longitudal_tire_extremumSlip = 0.05;
longitudal_tire_extremumValue = 0.1f;
longitudal_tire_asymptoteSlip = 0.1;
longitudal_tire_asymptoteValue = 0.05;
longitudal_tire_stiffnessFactor = 2000.0;
maximum_longitudal_stiffnessFactor = 3000.0;

Car mass = 1400




This works ok for me at this stage of my game developement but I am expecting to come back to this again in order to make it better.

Toby

15-12-2008 09:22:47

Thanks NickM. It's very hard to find good setting. How you set your suspension param?

You still using 0.9 and I can tell you that porting code to 1.0 is not too long. But A lot of change in code happen.

NickM

19-12-2008 12:08:12

Hi Toby, here's my spring and damper settings

spring_strength = 15000
damper_rate = 400