Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: schwarzenego on December 05, 2014, 12:35:55 PM

Title: UIFollowTarget question
Post by: schwarzenego on December 05, 2014, 12:35:55 PM
Hey,

If I remember correctly, some time ago I managed to have a sprite with UIFollowTarget to always remain in the screen, just in the right direction towards the target it was supposed to follow, and if I remember correctly, it was something built in, but apparently I cannot find it anymore. Is this feature still present? Think like an arrow always pointing to your destination, in the borders of the screen, even if its not visible. Right now all I see are the options to turn on/off the game object in the fact that its visible or not, but the sprite leaves the screen regardless.

Is there an easy way to achieve this?

Thanks for your attention,
Best regards,
Allan
Title: Re: UIFollowTarget question
Post by: schwarzenego on December 05, 2014, 12:53:31 PM
Im sorry, I asked before I tried... got it to work the way I want it to, thx anyway!

PS: If I could suggest something, I would suggest that you add this feature, its ultra simple to do, and is pretty useful.
Title: Re: UIFollowTarget question
Post by: Dengao on March 10, 2017, 07:55:57 AM
So what did you do?
Title: Re: UIFollowTarget question
Post by: ArenMook on March 10, 2017, 11:49:50 AM
UIFollowTarget's Update() function is what checks for the position. The "isVisible" check there on line 100 uses the screen position. You could simply clamp it there -- make sure the pos.x and pos.y are within 0-1 range, which will effectively force it to remain on screen.