- Home /
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.
You could use a physics overlapsphere ins$$anonymous$$d, if it's wall collision and such that you want to have.
Answer by Raggnarock · Aug 09, 2012 at 12:00 PM
What are you trying to achieve with it?
I would probably recommend SphereCast though, and then use the tags off the hitinfo. http://docs.unity3d.com/Documentation/ScriptReference/Physics.SphereCast.html
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.
Your answer
Follow this Question
Related Questions
How to create button for jumping in unity3d for iphone 1 Answer
How To Crop the Gallery image for iphone in unity3d 0 Answers
how to use specific touch in unity for iphone and ipod 1 Answer
Center camera on object in unity3d by programatically 1 Answer
After collision how the run animation to die animation will change.. 0 Answers