- Home /
How to make traction control for car?
Hello again!
I am trying to do a traction control for my car, that is, when I accelerate suddenly, the RPM goes up faster and the car slides slightly, what I did was modify the wheelcolliders when the gear change is less than 1, but not It convinces me (Rear traction bool = rear wheels acelerate).
if(RearTraction == true && Gear <= 1f)
{
WheelFrictionCurve frictionCurveTI = WheelTI.forwardFriction;
frictionCurveTI.stiffness = TractionStifness;
frictionCurveTI.extremumValue = TractionExtremumValue;
WheelTI.forwardFriction = frictionCurveTI;
WheelFrictionCurve frictionCurveTD = WheelTD.forwardFriction;
frictionCurveTD.stiffness = TractionStifness;
frictionCurveTD.extremumValue = TractionExtremumValue;
WheelTD.forwardFriction = frictionCurveTD;
}else{
WheelFrictionCurve frictionCurveTI = WheelTI.forwardFriction;
frictionCurveTI.stiffness = 0.2f;
frictionCurveTI.extremumValue = 20000f;
WheelTI.forwardFriction = frictionCurveTI;
WheelFrictionCurve frictionCurveTD = WheelTD.forwardFriction;
frictionCurveTD.stiffness = 0.2f;
frictionCurveTD.extremumValue = 20000f;
WheelTD.forwardFriction = frictionCurveTD;
}
I am trying to do something like this (watch the second 0:07): https://www.youtube.com/watch?v=tJf6AZ01Mbg
Thank you!
Answer by JonPQ · Apr 28, 2020 at 12:28 AM
if wheels are slipping, reduce the power to wheels quickly... say 10% per frame... until they stop slipping... once they are gripping... start increasing the power again ( but slower, say 5%). this will keep the wheels mostly gripping. You'll need to play with the 10% and 5% numbers though... depending on power and gearing of your car, 2wd or 4wd and surface slipperiness. ( you could have different settings for different surfaces, like off road vehicles do)
for the effect at 007 in the video you linked... that is slightly different from traction control. That is combining it with "Launch control" sort of.... You'd apply full brakes to front wheels, then power to rear wheels with traction control. You may need to fake this a bit depending on how accurate your physics are... but if your front brakes and grip, can provide more force than your rear wheels.... the car should stay still, while your traction controls will alternately slip and grip rear wheels. good luck. :)
Your answer
Follow this Question
Related Questions
Shift gear with own RPM? Help please! 0 Answers
Better RPM?? 0 Answers
transmission clutch help! 1 Answer
how to rotate car to camera direction using wheel colliders. 1 Answer
Car Gearbox script 1 Answer