Version 1 (modified by edy, 13 years ago) (diff)

--

CarWheel

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.

The parameters of the CarWheel script are uniformly controlled from the CarControl script so no parameters need to be configured here. Only configure the suspension parameters at WheelCollider.

WheelCollider's position

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.

WheelCollider's suspension

Radius (m): match the wheel's radius.

Suspension Distance (m): distance the wheel can travel due to the suspension.

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.

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.

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.

Typical good values are from 300 (bouncy) to 1000 (inelastic).

Note that the Damper value is frequently (and erroneously) used as a percentage. 0-100 will always result in a bouncy vehicle.

Other WheelCollider's parameters

  • Center: leave the default value (0,0,0).
  • Suspension Spring > Target Position: leave the defalut value (0).
  • Mass is absolutely meaningless, it doesn't affect anything. Must be greater than 0.
  • Forward Friction, Sideways Friction: these are calculated from the CarWheel script. The resulting values are based on the parameters configured at CarControl (ForwardWheelFriction / SidewaysWheelFriction).