AI car Script problem

I have an problem whit A.I car.

How do I stop the car to drive backwards after a crash and return to its normal position and continue driving on your way?

here is the code:

 var FrontLeftWheel : WheelCollider; 
 var FrontRightWheel : WheelCollider;

 var EngineTorque : float = 600.0;
 var waypointContainer : GameObject; 
 private var waypoints : Array; 
 private var currentWaypoint : int = 0;

private var inputSteer : float = 0.0; 
private var inputTorque : float = 0.0;

function Start () {

rigidbody.centerOfMass.y = -1.5;//-1.5

GetWaypoints(); }

function FixedUpdate() {

rigidbody.drag = rigidbody.velocity.magnitude / 250;

NavigateTowardsWaypoint();

FrontLeftWheel.motorTorque = EngineTorque * inputTorque;
FrontRightWheel.motorTorque = EngineTorque * inputTorque;

FrontLeftWheel.steerAngle = 20 * inputSteer; 
FrontRightWheel.steerAngle = 20 * inputSteer;

}

function GetWaypoints () {

var potentialWaypoints : Array = waypointContainer.GetComponentsInChildren(Transform ); waypoints = new Array();

for ( var potentialWaypoint : Transform in potentialWaypoints ) { if ( potentialWaypoint != waypointContainer.transform ) //!= { waypoints[ waypoints.length ] = potentialWaypoint; }

} } 


function NavigateTowardsWaypoint () {

var RelativeWaypointPosition : Vector3 = transform.InverseTransformPoint( Vector3( waypoints[currentWaypoint].position.x, transform.position.y, waypoints[currentWaypoint].position.z ));

inputSteer = RelativeWaypointPosition.x / RelativeWaypointPosition.magnitude;

if ( Mathf.Abs( inputSteer ) <= 0.5 ) //< 0.5 { inputTorque = RelativeWaypointPosition.z / RelativeWaypointPosition.magnitude - Mathf.Abs(inputSteer);//Abs

} else { inputTorque = 0.0; }

if ( RelativeWaypointPosition.magnitude < 15 ) //20 { currentWaypoint ++;

if ( currentWaypoint >= waypoints.length ) { currentWaypoint = 0;

}

}

}

I’m sorry but I couldn’t arse myself to decipher the code, but I have a simple suggestion:

Install a COLLIDER in your car (supposed that you haven’t done it already), and in your vehicle script you implement the appropriate hit or trigger function, as detailed in the manual:
http://unity3d.com/support/documentation/ScriptReference/Collider.html