Author Topic: UIFollowTarget question  (Read 2677 times)

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
UIFollowTarget question
« 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

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: UIFollowTarget question
« Reply #1 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.

Dengao

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: UIFollowTarget question
« Reply #2 on: March 10, 2017, 07:55:57 AM »
So what did you do?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIFollowTarget question
« Reply #3 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.