Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: psypol on September 07, 2018, 07:44:43 AM

Title: Reduce maximaly the 'lag' between GetPos/WorldToScreen/UIsetPos ?[SOLVED]
Post by: psypol on September 07, 2018, 07:44:43 AM
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.
Title: Re: Reduce maximaly the 'lag' between GetPos/WorldToScreen/UIsetPos ?
Post by: psypol on September 07, 2018, 07:48:27 AM
or should i modify the 3 actions i use to make them act in FixedUpdate ?
Title: Re: Reduce maximaly the 'lag' between GetPos/WorldToScreen/UIsetPos ?
Post by: psypol 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..
Title: Re: Reduce maximaly the 'lag' between GetPos/WorldToScreen/UIsetPos ?
Post by: jeanfabre 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