How to get A Camera Collision?


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”)

…my english is por…pls understand my problem…


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.