# How would I smooth this?

So My Question is simple… I would like to smoothDamp or Lerp (whatever is optimal)

I don’t know if there is a way to do so the way I have my code written… I only want to effect my x axis position… Otherwise I’ll have issues that I aint got enough tissues for. You don;t have to go threw and write it all out for me… I just need a good example… I checked everything relevant to Smooth on Script References, and all had me stumped because they don;t apply to my used method… Scratching head… Thanks in advance for any answers

function GoLeft(){

if(inCenterLane){
inCenterLane = false;
transform.position.x = (-1);
yield WaitForSeconds (CoolDown);
inLeftLane = true;

}

if(inRightLane){
inRightLane = false;
transform.position.x = (0);
yield WaitForSeconds (CoolDown);
inCenterLane = true;

}

}

function GoRight(){

if(inCenterLane){
inCenterLane = false;
transform.position.x = (1);
yield WaitForSeconds (CoolDown);
inRightLane = true;

}
if(inLeftLane){
inLeftLane = false;
transform.position.x = (0);
yield WaitForSeconds (CoolDown);
inCenterLane = true;

}

}

var forwardSpeed : int = 3;
var inLeftLane : boolean;
var inRightLane : boolean;
var desiredPos : float = 0;
var speed : float = 2;

function Update () {
//Move Forward//

gameObject.transform.position += Vector3.forward * Time.deltaTime * forwardSpeed;

if(infected = false)
desiredPos = Mathf.Clamp(desiredPos -( Input.GetKeyDown(KeyCode.A) ? 1 : 0) + (Input.GetKeyDown(KeyCode.D) ? 1 : 0), -1, 1);
transform.position.x = Mathf.Lerp(transform.position.x, desiredPos, Time.deltaTime * speed);
}