Can you make a freely spinning WheelCollider in Unity5?

I’m simulating a small aeroplane and I was using WheelColliders in Unity 4.5 for the wheels. Since switching to Unity 5 the wheels resist any kind of external forces. When I spin up the propeller and apply forces to the Rigidbody, the plane flips onto its nose!

Here’s the problem demonstrated on a cube with wheels:

43610-truck.gif

The wheels are default WheelColliders, the cube has mass 2000 and I’m applying a force of 10,000 using a very simple script:

public class Truck : MonoBehaviour
{
    bool push;

    void Update() {
        push = Input.GetKey("p");
    }

    void FixedUpdate() {
        if (push)
            GetComponent<Rigidbody>().AddForce(new Vector3(0, 0, 10000));
    }
}

Other experiments:

  • The truck will roll if you apply a small force before the truck “lands” when the level starts, so it hits the ground rolling ever so slightly.
  • The truck will also roll if you incline the slope to greater than 1.4 degrees (??). Anything less than that and it stays glued to the ground.

What’s going on here?

On further research, this seems to be a known issue with the WheelColliders in Unity 5.

See these forum posts:

There is a simple workaround though: Create an Awake() function that gives the wheels a non-zero motor torque and they will spin freely.

void Awake() {
	foreach (WheelCollider w in GetComponentsInChildren<WheelCollider>()) 
		w.motorTorque = 0.000001f;
}

This is low enough that the vehicle won’t start driving away but apparently enough that the wheels will turn freely.

check this video to solve problem of wheel collider bouncing on unity5