proof
15-02-2011 00:44:39
After a long day of trying to figure out on how to make my car stable, I finally figured out what was the problem.
The car just tends to roll over on any turn, which is seriously annoying. I figured out that by lowering its COM (Center of Mass), it stays stable. So when you create the body, you can do:
The point (0, 0, 0) works for me the best, but that's probably because the chassis is a little up from the ground, so if this doesn't work for you, try lowering the Y component to -0.5f. Note that if you go too far down, it starts rolling over in the opposite side.
With this COM and maximum steering angle of 30 degrees, back torque of 1000 and a mass of 1350 the vehicle acts fine with default settings for mLateralTireFunction and mLongitudinalTireFunction. I was playing around with those too and found out how to make the car drift a little:
I haven't managed to make suspensions work fine. If I increase mSuspension.mSpring, it either does nothing visible, or starts making my car float around and bounce a lot
When I finish gears, I will upload some classes I made for loading a car from a configuration file that looks something like:
Recompiling takes time
And, here's how my car looks:
The car just tends to roll over on any turn, which is seriously annoying. I figured out that by lowering its COM (Center of Mass), it stays stable. So when you create the body, you can do:
body->setCMassOffsetLocalPosition(0, 0, 0);
The point (0, 0, 0) works for me the best, but that's probably because the chassis is a little up from the ground, so if this doesn't work for you, try lowering the Y component to -0.5f. Note that if you go too far down, it starts rolling over in the opposite side.
With this COM and maximum steering angle of 30 degrees, back torque of 1000 and a mass of 1350 the vehicle acts fine with default settings for mLateralTireFunction and mLongitudinalTireFunction. I was playing around with those too and found out how to make the car drift a little:
mLateralTireFunction.mAsymptoteSlip = 0.04f;
mLateralTireFunction.mAsymptoteValue = 0.6f;
mLateralTireFunction.mExtremumSlip = 0.01f;
mLateralTireFunction.mExtremumValue = 1f;
mLateralTireFunction.mStiffnessFactor = 4000f;
mLongitudalTireFunction.mAsymptoteSlip = 0.04f;
mLongitudalTireFunction.mAsymptoteValue = 0.6f;
mLongitudalTireFunction.mExtremumSlip = 0.01f;
mLongitudalTireFunction.mExtremumValue = 1f;
mLongitudalTireFunction.mStiffnessFactor = 6000f;
I haven't managed to make suspensions work fine. If I increase mSuspension.mSpring, it either does nothing visible, or starts making my car float around and bounce a lot
When I finish gears, I will upload some classes I made for loading a car from a configuration file that looks something like:
CHA1 2.1 0.8 5.0 -0.005 0.653 0.005
CHA2 1.6 0.5 2.3 0.009 1.160 -0.473
MASS 1350
WHEEL_RADIUS 0.39
F_TORQUE 0
B_TORQUE 1000
MAX_STEER 30
FL_WHEEL 0.889 0.358 1.620
FR_WHEEL -0.889 0.358 1.620
BL_WHEEL 0.889 0.358 -1.440
BR_WHEEL -0.889 0.358 -1.440
LATTF 0.04 0.6 0.01 1 4000
LOGTF 0.04 0.6 0.01 1 6000
SUSPENSION 20 300 0 1
Recompiling takes time
And, here's how my car looks: