- Home /
why is sideways tire slip separated from forward slip on wheel collider?
Hi, I finally understood why my car in unity can't drift/powerslide like cars do in other racing games. Feel free to skip the boring part and only read the question down below if you know this issue.
problem:
Not realistic car grip/drift happens because tire slip value (from which the tire grip is evaluated) is separately measured for forward and sideways friction of wheel. That means when you are in a turn with RWD car and you give car more throttle, rear tires lose forward grip and start to slip forward but car won't start to drift sideways like in reality because even though rear tires started slipping forward, sideways slip is still the same thus there will be no change on sideways friction curve and car will not lose any sideways grip. For this same reason cars with unity wheel colliders can't do handbrake turns because rear wheels will start to slip forward but that only influences forward grip not sideways.
real tire physics:
From a physics standpoint it's obviously not realistic because when tire starts to slip it goes from static friction where it sits on road to kinetic friction where it is doing lots of little jumps and this "jumping state" of kinetic friction affects tire grip in all directions not just forward or sideways separately.
my theoretical solution:
So the obvious solution would be that we can keep separated friction curves (because of different tire tread designs) but the slip value for these friction curves must be only one, evaluated as magnitude of vector2 of sideways and forward tire movement (slip). Unfortunately we can't modify slip value only extremum, asymptote and stiffness of friction curve.
finally the question:
Is there something that I am missing with separated forward and sideways slips to make car drift realistically and if not, is there any workaround with friction curve parameters to fix this issue or can you suggest me some alternative wheel colliders which doesn't have this issue?
THX in advance :)
Answer by ENDAS_ORIGINAL · Aug 19, 2020 at 01:34 AM
After I posted another a bit more simplified question regarding this issue https://answers.unity.com/questions/1762293/how-to-make-handbrake-turn-or-powerslide-with-whee.html?childToView=1762679#comment-1762679 It turns out that this really is one of few current wheel collider's issues. Handbrake turning can easily be simulated with code that for example decreases rear wheel colliders sideways friction stiffness or extremum value (stiffness works better) when player uses handbrake. Throttle controlled power-slides are more complicated to accomplish with wheelcolliders, I tried to linearly decrease sideways stiffness or extremum value on rear wheels sideways friction curve when their forward spin exceeded extremum spin which helped but car was hard to control however if you have time for optimizing this kind of algorithm, you probably could make it work at some point. Another approach would be to apply a little side force on rear of the car to make it drift under specified circumstances. But if you really want to have fun and a realistic vehicle physics I highly suggest getting some vehicle physics system from unity asset store or alternative wheelcolliders from github.
Answer by Spip5 · Aug 16, 2020 at 08:14 PM
I think it makes perfect sense to have two separate frictions. Take an exemple of a car being thrown sideways on ice. You would have side friction due to momentum, and forward friction if you start accelerating, result in two friction combining/competing to actually move the car. The same logic applies for any surface. You start drifting when the momentum of the car increase sideway drift, and your forward drift cannot compete anymore.
Adding to the comment, if your sideway drift is too strong, you're in for some barrels rolls while trying to drift. To answer your question there is no perfect balance, it will very depend on the surface you are tryng to simulate. You can modify the slip bahaviour, the engine takes care of finding the value for you based on momentum and acceleration.
Thanks for answering :) I kinda get what you mean by separating forward and sideways friction but my point is that the slip value for both friction curves of wheel collider should be the same, (should be magnitude of vector of both sideways and forward slip) because how can you make for example handbrake turn with current wheel coll. system when if you engage handbrake and rear tires become locked, only the forward slip value increases causing forward friction curve to go closer to asymptote value and therefore losing forward grip but sideways slip value stays the same so no grip change occurs. Really all I wanna know is how am I supposed to make handbrake turn :D or power slide controlled by rear wheels torque because in my opinion, it is not possible with current unity wheel colliders.