Rigidbody controller stuck to the wall

Hi,

I made a controller based on this code
http://wiki.unity3d.com/index.php?title=RigidbodyFPSWalker
But when I jump into the wall, the character gets stuck while I press foward and makes things don’t work very well.
I already searchd a solution and tryed to apply it. Basically, was to avoid the movement using rigidbody.SweepTest.
But it isn’t working very well. Is there a way to suddenly stop the object speed instead of letting it slowly stop?(that causes to get stuck)

function FixedUpdate () {
		// Calculate how fast we should be moving
		var targetVelocity = new Vector3(Input.GetAxis("Horizontal"), 0, 0);
		var hit:RaycastHit;
		//Calculate if it's going to collide
			if(rigidbody.SweepTest(targetVelocity, hit, dist)){
			//Pretend that no keys were pressed
			targetVelocity. x = 0;
		}
		targetVelocity = transform.TransformDirection(targetVelocity);
		targetVelocity *= speed;
 
		// Apply a force that attempts to reach our target velocity

		var velocity = rigidbody.velocity;
		var velocityChange = (targetVelocity - velocity);
		velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange);
		velocityChange.y = 0;
		rigidbody.AddForce(velocityChange, ForceMode.VelocityChange);
	
		rigidbody.AddForce(Vector3 (0, -gravity * rigidbody.mass, 0));

}

someone else mentioned this

I told them to try adding a script to the wall objects.

you can stop by setting velocity to zero. its an instant stop

rigidbody.velocity = vector3.zero;

you could also use an OnCollisionEnter script on the wall
To test if the player is hitting the wall,
if it is see if the player is in the air,
if the player is in the air knock him back off the wall 
an inch.