| 1 | {{{ #!Markdown |
| 2 | |
| 3 | # CarWheel |
| 4 | |
| 5 | Controls the WheelCollider component for behaving as expected. Each physical wheel of the vehicle must consist of a gameObject containing a WheelCollider component and a CarWheel script. |
| 6 | |
| 7 | __The parameters of the CarWheel script are uniformly controlled from the [CarControl](wiki:CarControl) script__ so no parameters need to be configured here. Only configure the suspension parameters at WheelCollider. |
| 8 | |
| 9 | ## WheelCollider's position |
| 10 | |
| 11 | Place each WheelCollider object at the __outer limit of the wheel's mesh__. This will ensure the maximum stability, as the distance between the WheelColliders of the same axle will be the maximum possible. |
| 12 | |
| 13 | ## WheelCollider's suspension |
| 14 | |
| 15 | __Radius__ (m): match the wheel's radius. |
| 16 | |
| 17 | __Suspension Distance__ (m): distance the wheel can travel due to the suspension. |
| 18 | |
| 19 | __Suspension Spring > Spring__ (N): the spring sustains the weight of the vehicle. This value is the maximum force in Newtons the spring can apply when fully compressed. The more force, the higher the vehicle will rest (closer to maximum suspension distance). The less force, the closer to the top suspension limit the wheel will rest. |
| 20 | |
| 21 | A rough value for each spring is the half of the vehicle's weight in newtons. For instance, if the vehicle's mass is 2000 Kg, then a good spring value to start with is 2000 * 9.8 = 19600 / 2 = __9800__. |
| 22 | |
| 23 | __Suspension Spring > Damper__ (no idea on the units): this value means how much energy is lost when the spring compresses and extends. Low values mean a bouncy car, while high values means an inelastic suspension. |
| 24 | |
| 25 | Typical good values are from 300 (bouncy) to 1000 (inelastic). |
| 26 | |
| 27 | _Note that the Damper value is frequently (and erroneously) used as a percentage. 0-100 will always result in a bouncy vehicle._ |
| 28 | |
| 29 | ## Other WheelCollider's parameters |
| 30 | |
| 31 | - _Center_: leave the default value (0,0,0). |
| 32 | - _Suspension Spring > Target Position_: leave the defalut value (0). |
| 33 | - _Mass_ is absolutely meaningless, it doesn't affect anything. Must be greater than 0. |
| 34 | - _Forward Friction, Sideways Friction_: these are calculated from the CarWheel script. The resulting values are based on the parameters configured at [CarControl](wiki:CarControl) (_ForwardWheelFriction_ / _SidewaysWheelFriction_). |
| 35 | |
| 36 | }}} |