Author Topic: Updating position of graphic overlay  (Read 2787 times)

patch24

  • Guest
Updating position of graphic overlay
« on: May 07, 2012, 12:35:13 PM »
I have seen a few posts that point to various workflows, but I just wanted to see if anyone has found a better way.  I have a UI that lets the user select 3d objects in my scene. I have a main camera in the 3d scene and a UI specific camera looking at the NGUI stuff to overly on top of the main camera.
I'm wanting to put a 2d sprite overlay on screen that follows the objects that you target.    Is the best method for me to get world to screen position, and use my own update loop or coroutine to update the overlay sprite position?

I was picking through some of the helper functions included with NGUI and found some really cool stuff in there I didn't know about.  I was just wondering if there's something buried in there that would help with any part of what I'm trying to achieve?
Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Updating position of graphic overlay
« Reply #1 on: May 07, 2012, 03:03:55 PM »
You're doing it right. Convert from world to screen space in the update function (or coroutine) and use it to position the sprite.