VWheelCollider

Author: Venryx (venryx)

Description
A basic replacement for the built-in WheelCollider component. One of the main things it lacks is a realistic friction model; all it currently does is apply forward and sideways forces to counteract the 'slip', which is itself just a measure of how much the wheel is moving. That said, it's working fine for basic movement, and can serve as the base for a more comprehensive replacement.

Main script - VWheelCollider
Create a new C# script named "VWheelCollider" and paste the following code:

Dependencies - ClassExtensions, VPhysics
The ClassExtensions class just adds a couple methods for finding parents/children.

The VPhysics class is just a wrapper for the built-in Physics.Raycast and Physics.RaycastAll functions, that handles layer-masks in a way I prefer (passing layer names in instead of bit-shifted integers).

Assuming you don't want to take out the helper-classes before you've even tried the system, create a new C# script named "VExtras" and paste the following code:

Usage
There are a couple things you have to do to get the VWheelCollider working for a vehicle:
 * The VWheelColliders do not add any spring forces, so to keep the wheels from falling through the terrain, you need to place a sphere-collider (or equivalent) for each wheel, with its radius set to the wheel's radius.
 * Some sort of controller script is needed (as with the built-in WheelColliders). Here's an example: