🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Car Spinout in Unity

Started by
0 comments, last by sprotz 5 years, 11 months ago

How do I go about adjusting the tendency for a car to spinout in Unity? The standard assets car physics have drifting but no spinout. I read that spinout is caused by the rear tyres losing traction but I think rear traction is dynamic, not static. Does it depend on lateral velocity of the rear wheels? I need at least a tutorial with code example (in javascript) if not a demo project.

There is a similar topic here: https://www.gamedev.net/forums/topic/686144-car-skidding-behavior/  , but the answer is half complete. It says that braking shifts the car load to the front thus reducing friction on the rear wheels.  Perhaps I could put in a code that accordingly adjusts friction on the tyres depending on braking or acceleration action, with braking reducing rear traction, and acceleration reducing front traction. Also making motor force directly proportional to the traction on a set of wheels, depending on whether it is rear wheel drive, front wheel drive or 4WD.

Making a turn without accelerating or braking also shifts the car load in one spot, I assume, affecting traction on each of the four wheels because of suspension, and because lateral friction is higher than forward friction, making a sort of 'sideways braking', with areas of less load getting less traction.

OK, I have found a pdf ebook that discusses vehicle physics in games here: https://nccastaff.bournemouth.ac.uk/jmacey/MastersProjects/MSc12/Srisuchat/Thesis.pdf

And below is the solution I got combining these equations to calculate the weight load on each of the four wheels when cornering and/or braking. Hope this is right.

car_physics_cornering_tyre_load.png

So here is the procedure for each tyre:

  • calculate the static load on each axle (front load/rear load equation), divide by 2  to get the load on one tyre
  • Calculate and Add the forward weight shift(subtract for rear tyres), divide by 2
  • Calculate and add the Lateral weight shift (subtract for tyres on the side the car is turning), divide by 2 if centered center of gravity, if not, multiply by c/L for front tyre, by b/L for rear tyre

This topic is closed to new replies.

Advertisement