How to get A Camera Collision?

hello,

I want some information…can we write code for camera collision…

Actually i done, that camera taken as spherecollider and tagged the camerea,i collision function for that,it is not working…

void OnControllerColliderHit(ControllerColliderHit hit)

{

Debug.Log (hit.gameObject.tag);
if(hit.gameObject.tag == “MainCamera”)
{

Debug.Log(hit.gameObject.tag);
}
}
…my english is por…pls understand my problem…

Thanks.

What are you trying to achieve with it?

I would probably recommend SphereCast though, and then use the tags off the hitinfo.

If you are trying to tell if the camera is within a certain distance of something such as the player, I would use a method to find the distance between a character and the camera.