Wheel Collider:

The Wheel Collider is a special collider for grounded vehicles. It has built-in collision detection, wheel physics, and a slip-based tire friction model. It can be used for objects other than wheels, but it is specifically designed for vehicles with wheels.

 

 

 

 

 

 

 

 

 

 

 

 

 

Properties

Property: Function:
Center Center of the wheel in object local space.
Radius Radius of the wheel.
Suspension Distance Maximum extension distance of wheel suspension, measured in local space. Suspension always extends downwards through the local Y-axis.
Suspension Spring The suspension attempts to reach a Target Position by adding spring and damping forces.
        Spring Spring force attempts to reach the Target Position. A larger value makes the suspension reach the Target Position faster.
        Damper Dampens the suspension velocity. A larger value makes the Suspension Spring move slower.
        Target Position The suspension’s rest distance along Suspension Distance. 0 maps to fully extended suspension, and 1 maps to fully compressed suspension. Default value is zero, which matches the behavior of a regular car’s suspension.
Mass The Mass of the wheel.
Forward/Sideways Friction Properties of tire friction when the wheel is rolling forward and sideways. See the Wheel Friction Curves section below.
The Wheel Collider Component. Car model courtesy of ATI Technologies Inc.
The Wheel Collider Component. Car model courtesy of ATI Technologies Inc.

Details

The wheel’s collision detection is performed by casting a ray from Center downwards through the local Y-axis. The wheel has a Radius and can extend downwards according to the Suspension Distance. The vehicle is controlled from scripting using different properties: motorTorque, brakeTorque and steerAngle. See the Wheel Collider scripting reference for more information.

The Wheel Collider computes friction separately from the rest of physics engine, using a slip-based friction model. This allows for more realistic behaviour but also causes Wheel Colliders to ignore standard Physic Material settings.

Wheel collider setup in unity3d:

You do not turn or roll WheelCollider objects to control the car – the objects that have the WheelCollider attached should always be fixed relative to the car itself. However, you might want to turn and roll the graphical wheel representations. The best way to do this is to setup separate objects for Wheel Colliders and visible wheels:

 

 

 

 

 

 

 

 

The Wheel Collider Component. Car model courtesy of ATI Technologies Inc.

 

Details

The wheel’s collision detection is performed by casting a ray from Center downwards through the local Y-axis. The wheel has a Radius and can extend downwards according to the Suspension Distance. The vehicle is controlled from scripting using different properties: motorTorque, brakeTorque and steerAngle. See the Wheel Collider scripting reference for more information.

The Wheel Collider computes friction separately from the rest of physics engine, using a slip-based friction model. This allows for more realistic behaviour but also causes Wheel Colliders to ignore standard Physic Material settings.

Wheel collider setup:

You do not turn or roll WheelCollider objects to control the car – the objects that have the WheelCollider attached should always be fixed relative to the car itself. However, you might want to turn and roll the graphical wheel representations. The best way to do this is to setup separate objects for Wheel Colliders and visible wheels:

 

 

 

 

 

 

 

 

 

 

 

Wheel Colliders are separate from visible Wheel Models:

If you want to update the position of the graphical wheel representations according to the suspension position you can use the example for WheelCollider.GetGroundHit in the Scripting Reference. Note that the gizmo graphic for the WheelCollider’s position is not updated in playmode:

Position of WheelCollider Gizmo in runtime using a suspension distance of 0.15

Collision geometry:

Because cars can achieve large velocities, getting race track collision geometry right is very important. Specifically, the collision mesh should not have small bumps or dents that make up the visible models (e.g. fence poles). Usually a collision mesh for the race track is made separately from the visible mesh, making the collision mesh as smooth as possible. It also should not have thin objects – if you have a thin track border, make it wider in a collision mesh (or completely remove the other side if the car can never go there).

unity3d physics reference

Unity3d tutorials