Author Topic: HUDText blinking when following main character  (Read 3331 times)

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
HUDText blinking when following main character
« on: August 11, 2014, 02:14:46 PM »
Hey,

Im implementing Hud Text on my game and it works perfectly for enemies, however the player's hud text is, like the other guy mentioned, "shaky"... it doesnt follow the main character smoothly.

The main character is rendered by the main camera, which moves with him, and Hud Text is rendered by the UI Camera, which is stationary, and is the same camera that renders the rest of the UI done also with NGUI.

I am currently using NGUI version 3.6.9 and HUD Text version 1.12.

Any ideas on how I can fix that/why this is happening? Unlike the post from the other guy it happens when I walk but regardless of collisions or stuff like that, just the generic walking, which by the way is exactly the same code I use on my enemies to move, the same class.

EDIT: Tried changing HUDText from Update to LateUpdate and placing it in the last place in the Execution Order... no change =/

Thanks,
Regards,
Allan
« Last Edit: August 11, 2014, 05:02:31 PM by schwarzenego »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HUDText blinking when following main character
« Reply #1 on: August 12, 2014, 07:40:58 AM »
All UI movement snaps to pixels, while 3D object tracking won't, so while 3D object may appear to move smoothly, the 2D that tracks it won't. If you wish, you can disable this by commenting out lines 100 and 101 in UIFollowTarget.cs:
  1.                         pos.x = Mathf.FloorToInt(pos.x);
  2.                         pos.y = Mathf.FloorToInt(pos.y);

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: HUDText blinking when following main character
« Reply #2 on: August 12, 2014, 10:36:07 AM »
Thanks, even though LateUpdate/Execution time did solve the problem, I will try it out. However it was blinking a lot more than 1 pixel, more like 30-40 pixels a time...

But anyway, thanks!