Camera Collider

Is there a way to make a character controller not slide along colliders, but rather stop moving when it collides with a wall?

I’m trying to implement a third person camera that doesn’t slide along walls, but rather adjusts it’s distance to the player and maintains the same angle to the player.

This is a snippit of code–

function LateUpdate(){
cameraTransform.position = (target.position);
	theController.Move(-cameraTransform.forward * cameraDistance);


}

function OnControllerColliderHit (hit : ControllerColliderHit){
	cameraDistance = (cameraTransform.position - target.position).magnitude;
	print(cameraDistance); //this = 0 ??
}

Do the variables not update while the Move() function is called? Maybe there is a better way to do this…

to qualify this,

I am raycasting to determine proximity to walls, however this fails at steep angles, as the raycast will continue, while the camera will collide with a wall.

This is an extreme case, but a solution would be handy. The simplest solution from my point of view would be to force the camera to stop if it collides with anything, a ‘sticky’ character collider.