Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: yohann on January 23, 2014, 07:08:23 PM
-
I have an NGUI UI with a 3 x 3 grid of crosshairs that overlays a first person view. That all works great, but now I need to be able to do/show stuff when each of those 9 crosshairs overlays an object in the 3D world.
Maybe put simpler, how do I detect when an NGUI element is over a 3D gameobject, and then get info about that 3D object?
I'm usually pretty good at figuring stuff out, but I'm at a loss here of where to even start. Any ideas or direction is greatly appreciated!!
-
Edit: I misunderstood the question the first time. To detect when an NGUI widget is over a 3D object, you need to do your own Physics.Raycast into the screen. To determine the widget's position in screen space, get the transform.position and convert it to screen space via Camera.WorldToScreen (check Unity's docs).