I am working on a car-racing game on Unity 2018.1. My car works perfectly at low speed but as it speeds up, I lose control over the car and it starts to drift independently. What can I do to prevent this?
I think it can be acheived using different ways :
- Increase the friction on your PhysicsMaterials as Linaith pointed out. It is worth noting that you should have one PhysicsMaterials for your road and one for your tires, and play with the "Friction Combine" parameter ;
- Increase the "drag" and/or "angular drag" value on your rigidbody component ;
- Use a compensation force as explained at 4:50 in this video. The goal is very simple : apply a force to the opposide side of the side you are drifting (slightly smaller to allow a bit of drifting though).
I personnaly went for the last one which gives me more control over the car as I am going for a more arcade gameplay. I believe that the other two are more suited for simulation gameplay.