- Home /
Detect object in a specific part of the screen
Hi,
I am wondering if it is possible to detect when a gamobject has entered a certain part of the view, no matter how far away it is. For example I have a circle in the middle of my screen that is 40 pixels in diameter. I would like to know when a gameobject has entered that area, so I can get information about it. My camera is using perspective as it is an FPS.
I guess I could just use a massive cylinder collider but that seems a bit much.
Any ideas?
Thanks!
Paul
Answer by Meltdown · Jul 17, 2013 at 10:19 PM
Use Camera.WorldToScreenPoint for your object, and when it's screen space boundaries intersect with that of your circle, then you know it has entered that area.
Great! Got something working using that $$anonymous$$elton. Thanks!
Your answer
Follow this Question
Related Questions
Can I detect detect if I clicked on same spot which is enlighted by spotlight? 0 Answers
OnMouseUp() Update? Movement. 1 Answer
give a command to a specific instantiated object 2 Answers
Is there a way to tell a point light only to apply to specific Object(s) 1 Answer
character melee combat problem 1 Answer