Camera flickering when rotating around object

Hi everyone.
I really don’t know why this happens. But for me it seems not to be a problem with the collision. In the following videos, there aren’t any objects behind the camera. So why does this happen?

Please take a look:

https://dl.dropboxusercontent.com/u/2935685/unity/Unity%202014-08-29%2021-24-24-87.1.avi
and
https://dl.dropboxusercontent.com/u/2935685/unity/Unity%202014-08-29%2021-25-30-40.1.avi

The following script is what I’m using for the camera.
I hope you guys can give me some tipps.

var target : Transform;
var distance = 10.0;
 
var xSpeed = 150.0;
var ySpeed = 100.0;
 
var yMinLimit = 5;
var yMaxLimit = 80;
 
var distanceMin = 3;
var distanceMax = 15;
 
private var x = 0.0;
private var y = 0.0;
 
 
@script AddComponentMenu("Camera-Control/Mouse Orbit")
 
function Start () {
    var angles = transform.eulerAngles;
    x = angles.y;
    y = angles.x;
 
	// Make the rigid body not change rotation
   	if (rigidbody)
		rigidbody.freezeRotation = true;
}
 
function LateUpdate () {
    if (target) {
        x += Input.GetAxis("Mouse X") * xSpeed * distance* 0.02;
        y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02;
 
 		y = ClampAngle(y, yMinLimit, yMaxLimit);
 
		var rotation = Quaternion.Euler(y, x, 0);
 
		distance = Mathf.Clamp(distance - Input.GetAxis("Mouse ScrollWheel")*5, distanceMin, distanceMax);
 
		var hit : RaycastHit;
		if (Physics.Linecast (target.position, transform.position, hit)) {
				distance -=  hit.distance;
		}
 
        var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
 
        transform.rotation = rotation;
        transform.position = position;
        
        //Hide the cursor
		Screen.showCursor = false;
 
	}
 
}
 
 
static function ClampAngle (angle : float, min : float, max : float) {
	if (angle < -360)
		angle += 360;
	if (angle > 360)
		angle -= 360;
	return Mathf.Clamp (angle, min, max);
}

or

Good luck!

I tried to add a camera bumper, but it’s still not working.
Here’s the code:
var target : Transform;
var distance = 10.0;

var xSpeed = 150.0;
var ySpeed = 100.0;
 
var yMinLimit = 5;
var yMaxLimit = 80;
 
var distanceMin = 3;
var distanceMax = 15;
 
private var x = 0.0;
private var y = 0.0;


////////////////////////test
var distance_bumper : float = 3.0;
var height : float = 1.0;
var damping : float = 5.0;
var smoothRotation : boolean = true;
var rotationDamping : float = 10.0;
 
var targetLookAtOffset : Vector3; 		// allows offsetting of camera lookAt, very useful for low bumper heights
 
var bumperDistanceCheck : float = 2.5;	// length of bumper ray
var bumperCameraHeight : float = 1.0; 	// adjust camera height while bumping
var bumperRayOffset : Vector3; 		// allows offset of the bumper ray from target origin


////////////////////////////////
function FixedUpdate() {
 
	var wantedPosition = target.TransformPoint(0, height, -distance_bumper);
 
	// check to see if there is anything behind the target
	var hit : RaycastHit;
	var back = target.transform.TransformDirection(-1 * Vector3.forward);	
 
	// cast the bumper ray out from rear and check to see if there is anything behind
	if (Physics.Raycast(target.TransformPoint(bumperRayOffset), back, hit, bumperDistanceCheck) 
              && hit.transform != target) { // ignore ray-casts that hit the user. DR
        // clamp wanted position to hit position
		wantedPosition.x = hit.point.x;
		wantedPosition.z = hit.point.z;
		wantedPosition.y = Mathf.Lerp(hit.point.y + bumperCameraHeight, wantedPosition.y, Time.deltaTime * damping);
	} 
	 
}

///////////////////end test

 
 
@script AddComponentMenu("Camera-Control/Mouse Orbit")
 
function Start () {
    var angles = transform.eulerAngles;
    x = angles.y;
    y = angles.x;
 
	// Make the rigid body not change rotation
   	if (rigidbody)
		rigidbody.freezeRotation = true;
}
 
function LateUpdate () {
    if (target) {
        x += Input.GetAxis("Mouse X") * xSpeed * distance* 0.02;
        y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02;
 
 		y = ClampAngle(y, yMinLimit, yMaxLimit);
 
		var rotation = Quaternion.Euler(y, x, 0);
 
		distance = Mathf.Clamp(distance - Input.GetAxis("Mouse ScrollWheel")*5, distanceMin, distanceMax);
 
		var hit : RaycastHit;
		if (Physics.Linecast (target.position, transform.position, hit)) {
				distance -=  hit.distance;
		}
 
        var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
 
        transform.rotation = rotation;
        transform.position = position;
        
        //Hide the cursor
		Screen.showCursor = false;
	}
}


 
 
static function ClampAngle (angle : float, min : float, max : float) {
	if (angle < -360)
		angle += 360;
	if (angle > 360)
		angle -= 360;
	return Mathf.Clamp (angle, min, max);
}