playMaker

Author Topic: Reduce maximaly the 'lag' between GetPos/WorldToScreen/UIsetPos ?[SOLVED]  (Read 1759 times)

psypol

  • Playmaker Newbie
  • *
  • Posts: 39
hi
any ideas how to fight against a 'lag' inbetween camera movement and a UI element update onscreen?

i have a FSM
- grabbing a scene object X and Y world position
- immediately doing 'WorldToScreenPoint'
- applying this position to a UI canvas element.

The goal is to have an info bubble which flies above an object and is UI (not worldspace)
Usage example: Imagine you have a door and over the handle i want a bubble saying "press E to open"

Now my camera is a FPS style controlled with the mouse.
The problem is that if user moves the camera around, even gently, the UI info bubble updates it's position onscreen with some latency.
i basically want to get rid of this latency to the maximum.

i have been reading posts about:
https://answers.unity.com/questions/828905/what-is-1-and-what-is-2-in-vsynccount.html but the 3 options here don't seem to make any difference.

I also tried to make the set position normaly or as "late update" but it does not change anything.

Long story short : since this UI element is the thing in front of the eyes of players at all times i want it to be as responsive as possible and with a lag inferior to what human eye can catch.
Also i dont want lag on slower harware configs.

stumbled upon these posts:

https://docs.unity3d.com/Manual/ExecutionOrder.html

https://docs.unity3d.com/Manual/class-MonoManager.html
not sure if i can make an FSM (custom script ?) as the highest prio in my project ?

https://hutonggames.com/playmakerforum/index.php?topic=4095.msg19134#msg19134

https://hutonggames.com/playmakerforum/index.php?topic=3858.msg17862#msg17862

there are so many options here that i don't know in which direction to start.
maybe someone can help me save some long experimentation hours ?
thanks in advance.
« Last Edit: September 21, 2018, 03:16:34 AM by jeanfabre »

psypol

  • Playmaker Newbie
  • *
  • Posts: 39
Re: Reduce maximaly the 'lag' between GetPos/WorldToScreen/UIsetPos ?
« Reply #1 on: September 07, 2018, 07:48:27 AM »
or should i modify the 3 actions i use to make them act in FixedUpdate ?

psypol

  • Playmaker Newbie
  • *
  • Posts: 39
Re: Reduce maximaly the 'lag' between GetPos/WorldToScreen/UIsetPos ?
« Reply #2 on: September 07, 2018, 09:00:42 AM »
ok so recreating GetPosition + WorldToScreenPoint and SetPosition as customActions doing their thing in LateUpdate improved the result..

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Reduce maximaly the 'lag' between GetPos/WorldToScreen/UIsetPos ?
« Reply #3 on: September 21, 2018, 03:16:24 AM »
Hi,

 yes, good point.

 Check on the Ecosystem for "advanced" versions of these actions, you have GetPositionAdvanced, SetPositionAdvanced, and I just created the WorldToScreenAdvanced and ScreentoWorldAdvanced.

 so for those who can't create custom actions, you should be able to do that too

Bye,

 Jean