- Home /
How to detect Game Object is touched in Unity iPhone?
is there a function such as isTouched()? or other examples i can refer to? thank you very much!
Comment
Best Answer
Answer by Dreamora 1 · Oct 08, 2010 at 07:02 AM
you do a raycast at the touch position and see what you hit.
there are a few dozen threads on the matter on the board for the OnMouseOver replacement :)
if (Physics.Raycast (ray, hit, 200)) { var objecthit:Transform = hit.transform as Transform;
// What are you hitting?
if (hit.collider.tag == "3DButton") doStuff()
}
Your answer
Follow this Question
Related Questions
Detecting touch on cloned prefabs 1 Answer
iPhone - finger keeps touching screen 1 Answer
Multiple touch iPhone Buttons 0 Answers
How to display Swipe Marks on iPhone 1 Answer