Hello there, i was messing around with unitys wheel collider for a week now. Wher ever i read, mostly i get bad feedback about wheel colliders, but i think that physx wheel colliders are actually pretty good, they only need a little extra script for dynamic friction (i also started a thread in the scripting section, to see how many people know various methods for dynamic friction, but without succsess).
So what i did here, is i took Andrews car tutorial (http://www.gotow.net/andrew/blog/?page_id=78, thank you!)
and started tweaking it, switched the original track to a custom terrain one, added differential ratio, few visual effects(projector, light flares etc.), some simplyfied scripts to change friction suspension easly in one inspector and finally i also added antirollbars from edy’s tutorial.
Oh yes i was also busy updating the real script, so i did not update the ai one, so the waypoints exist and the script is also there but its “outdated”…
So at wheel friction part, i tryed to use as lifelike values as possible, and i hope that unity/physx reads them also that way.
Heres what i use for longitudinal lateral friction curves:
var ForwardExtremumSlip : float = 10;//slip ratio where the tire grips at most;
var ForwardExtremumValue : float = 100;//100% of the available friction is used;
var ForwardAsymptoteSlip : float = 100;//slip ratio where the curve has no grip;
var ForwardAsymptoteValue : float = 0;//0% of the friction available is used;
var ForwardStiffness : float = 1.0;
var SidewaysExtremumSlip : float = 6;//slip angle where the tire grips at most;
var SidewaysExtremumValue : float = 100;//100% of the available friction is used;
var SidewaysAsymptoteSlip : float = 40;//slip angle where the curve has minimal grip;
var SidewaysAsymptoteValue : float = 1;//1% of the available friction is used;
var SidewaysStiffness : float = 2.0;// 2 just worked better...
I’ll explain my theory abit, well car wheels have logical parameters for movement (in longitudinal lateral ways)
they are slip ratios and slip angles. So i tryed to use slip angle and slip ratio parameters to achieve my friction results.
The only unrealistic thing i made here, is that I made the curves more like simple peaks, the curves start from 0 and raise a griping position and after that they decrease to 0 or 1.
In real life this does not happen, in real life both forward and sideways frictions are combined and cut by longitudinal or lateral movement, for this kind of simulation we need a dynamic friction script (withc i was talking earlyer)
Since i did not manage to create a script that would do such thing, I faked the curves by simply decreasing the curves to 0 or 1 (minimal grip). Its not a realistic solution, but It seems to me that these “mountain” values work quite well actually.
Obviously some have discovered this before, but i did not find any reference to this, so i decided to share my knowledge.
The car model i found from the internet, and i dont know who the author is, anyway it’s only a placeholder to visualise a vehicle …obviously.
NOTE
There are alot of other things that need to be fixed (engine torque, gearbox etc.), but i was concentrating on the wheel friction enjoyable handling!
Image:
UnityPackage:
And finally, if you make any changes to it please share your knowledge!