Smooth Character Movement

I’m working on a 2D game and I want to know how to move my character smoothly like a ease in ease out type of thing. I though about using lerp but that doesn’t work because the start and end vectors would be two global points. Here is what I have so far, how do I make it smooth?

var speed : float;

function Update(){
	transform.position.x = 0;

function MoveFunc(){
	var controller : CharacterController = GetComponent(CharacterController);
		controller.Move(Vector3.forward * -speed * Time.deltaTime);
		controller.Move(Vector3.forward * speed * Time.deltaTime);


Use Input.GetAxis for this, and define your own axis under Edit>Project Settings>Input

For instance Input.GetAxis( “Horizontal” ), will, when you press the left key shoot from zero to -1 over a small amount of time, and to +1 if you press the left key. This small amount of time allows you to define

if( Input.GetAxis( "Horizontal" )
    transform.Rotate( Vector3.up, rotSpeed * Input.GetAxis( "Horizontal" );

When you press left or right, after about half a second GetAxis will return -1/1, so the object will rotate at full ‘rotSpeed’ around it’s y axis. In the first half second it will rotate slower, because (for instance) GetAxis will return 0.5 after 0.1 seconds of pressing right, so it’ll rotate to the right at half spead.

Setting up an axis for your needs takes a lot of tweaking, but it’s the best way to get smooth easing in and out of movement.