- Home /
Do wheel colliders account for wheel width?
hello, i am still fairly new to unity and want to make a sandbox game, that will have vehicles involved and i was wondering if there was any way to make my actual wheels act as wheel colliders, or if the unity wheel colliders could take into account customized wheel widths, because i noticed that the unity wheel collider is represented by a paper thin circle. and i am not sure if that is the reason why the last time i tried to make a car in unity it kept rolling over, i know that with wider wheels it adds more stability, and you can also send more torque through the wheels with less loss of traction.
Answer by gunpower · Jun 23, 2014 at 05:52 AM
You are correct, WheelCollider does not account for wheel width. It's not even a paper thin circle, actually. It is simply a single ray, with a bunch of extra bells and whistles. Generally speaking, you can't make your wheel model represent your wheel collider, as using a mesh collider would require it to be convex and would be prohibitively taxing for the physics engine.
Some people create their own with joints and/or the other simple colliders, like the sphere collider or capsule collider. They lean more towards simulations and racing games, though. Most who have ventured down that path have put tons of work into it, and are less likely to freely share the finer details - which is completely understandable once you start diving into it - and their results usually show up in the asset store rather than unityAnswers responses.
If your sandbox project doesn't need simulation quality, I suggest you stick with the stock WheelCollider approach. A few tips for that:
1) User Edy has posted pretty helpful stuff in the forums. Particularly, he has posted some great beginner values for the wheel traction parameters and supplied a little script that gives and arcade-like anti-swaybar that will help the car from rolling. It has a small side effect that makes it feel like the hand of god is keeping it stable but if your game is more arcadelike than simulation it works superb. Search the forums for his posts.
2) adjust the center of gravity by creating an empty gameobject to sit within your model so that you can position that object in the editor, and assign the CoG of the cars rigidbody to that gameobjects position when your car script starts up (instead of the default behavior where the rigidbody just picks the middle of all attached colliders). Position the CoG near the floorboards and slightly forward of center.
3) (and I just did this myself - never saw anybody else post this) don't position your colliders on the centerline of the wheel. Position them at the wheel face, so that the outer limits of the wheel are represented by the WheelCollider.
4) If you haven't downloaded unity's car tutorial, do so.
5) If you haven't checked out the optional "advanced physics model" inside that tutorial, do so!
Your answer
Follow this Question
Related Questions
Wheelcolliders stuck in ground 0 Answers
Creating a simple wheel 0 Answers
Best Settings/Config Wheelcollider Tank 0 Answers
Calculate Distance using WheelColliders 3 Answers
WheelCollider spontaneous jumping? 0 Answers