Help with Character Controller

Hey, I have made a Character Controller that moves around, it works fine but when you go from right to left or forward to backward the transition between directions isn’t smoothed and the transform.forward just changes instantly. I was wondering if anyone knew how to make the transition smooth so the the Player rotates from the current rotation to the next for example right to left. Here is my current Code, if anyone can help that would be nice.

private var moveSpeed : float = 12.0;
private var Drag = 3;
private var ADrag = 3;
private var grounded : boolean;
private var jumpVelocity : float = 8;

private var bottomRight = (Vector3.right + Vector3.back).normalized;
private var bottomLeft = (Vector3.left + Vector3.back).normalized;
private var topRight = (Vector3.right + Vector3.forward).normalized;
private var topLeft = (Vector3.left + Vector3.forward).normalized;

function Update(){

if(grounded){

rigidbody.drag = Drag;
rigidbody.angularDrag = ADrag;

}

		if(Input.GetButton("Forwards")){
		transform.forward = Vector3.forward;
			rigidbody.AddForce(transform.forward * moveSpeed);
		}
		if(Input.GetButton("Backwards")){
		transform.forward = Vector3.back;
			rigidbody.AddForce(transform.forward * moveSpeed);
		}
		if(Input.GetButton("Right")){
		transform.forward = Vector3.right;
			rigidbody.AddForce(transform.forward * moveSpeed);
		}
		if(Input.GetButton("Left")){
		transform.forward = Vector3.left;
			rigidbody.AddForce(transform.forward * moveSpeed);
		}
		if(Input.GetButton("Forwards") && Input.GetButton("Right")){
		transform.forward = topRight;
			rigidbody.AddForce(transform.forward * moveSpeed/2);
		}
		if(Input.GetButton("Forwards") && Input.GetButton("Left")){
		transform.forward = topLeft;
			rigidbody.AddForce(transform.forward * moveSpeed/2);
		}
		if(Input.GetButton("Backwards") && Input.GetButton("Right")){
		transform.forward = bottomRight;
			rigidbody.AddForce(transform.forward * moveSpeed/2);
		}
		if(Input.GetButton("Backwards") && Input.GetButton("Left")){
		transform.forward = bottomLeft;
			rigidbody.AddForce(transform.forward * moveSpeed/2);
		}
	
	if(!grounded){
	
	rigidbody.drag = 7;
	rigidbody.angularDrag = 7;
	
	}
	
}


function OnCollisionEnter(){
	grounded = true;
}

function OnCollisionExit(){
	grounded = false;
}

function OnCollisionStay(){
	if(Input.GetButtonUp("Jump")){
		rigidbody.velocity.y = jumpVelocity;
	}

}

I’m making a game which has driveable tanks and i managed to make it smooth. Here’s an example that should work for you:

var Speed : float;
var MaxSpeed : float;
var MinSpeed : float;

var SideSpeed : float;
var Maxside : float;
var Minside : float;

function Update() {

// Forward
  if (Input.GetKey("Up")) {
  if (Speed < MaxSpeed) {
  Speed += 0.01;
  }
  } else {
  if (Speed > 0.01) {
  Speed -= 0.01;
  }

// Back
  if (Input.GetKey("Down")) {
  if (Speed > MinSpeed*-1) {
  Speed -= 0.01;
  }
  } else {
  if (Speed < 0.01) {
  Speed += 0.01;
  }

// left and right here

transform.position += transform.forward * Speed * Time.deltaTime;

// move to the side code here
}

To move on the sides you just need to put the same code but replace Speed with SideSpeed and the min and max values. Hope this helped you.