I have a UserWidget with an Event Tick function and I am using the blueprint node ConvertWorldLocationToScreenLocation on a static actor location then [Set Position in Viewport] on widget – when I run the game and shake the FPS camera up/down or left/right the widget appears to lag behind by a frame. The problem is very noticeable if I add a DrawDebugString() to the same actor. The distance between the widget and the text will vary while the head moves then stabilize when the head stops. Looking at the code for DrawDebugString() it seems to delay the Canvas->Project() until just before rendering.
My character class has a UCameraComponent attached to the CapsuleComponent which I think is pretty standard.
I’m not sure if I need change the TickGroup of something… FSlateApplication::Tick() seems to be called very late already.
Has anyone heard of this issue before… any suggestions?
Using APlayerController::ProjectWorldLocationToScreen() from ACharacter::Tick() produces bad results.
Internally it uses PlayerCameraManager which relies on something called CameraCache which is not updated until TG_PostPhysics.
I am hesitant to move our entire character class to a later TickGroup.
I discovered that I can override APlayerController::GetPlayerViewpoint() and not use the PlayerCameraManager but just use the controller rotation etc. which is updated immedately after input.
Another work-around highlights the fact that the Widget default Tick event is questionable.
You can add a SecondaryActorTick to your Character class and set it to TG_PostUpdateWork – this ensure that it is AFTER the TG_PostPhysics update used by the PlayerCameraManager
If you bind that custom event SecondaryTick in your Widget blueprint and use that instead of Event Tick – then you can use the standard ConvertWorldLocationToScreenLocation blueprint node and it will produce screen coordinates in synch with the latest camera movement.
It would be nice if you could just configure the Tick Group for User Widgets – if that is not a viable default for all widgets.