Widget moves around when player is moving

Hey,
Basically the same question from answerhub , but reposting it for greater visibility :

I’m trying to have a floating umg widget above each enemy. I have created an umg widget with just an image and I am moving it to the enemy position on every tick.

If my character doesn’t move it stays still but as soon as my character moves it moves a bit as well. It jitters a bit from right to left depending on the direction my character moves. It’s almost like it tries to follow my character but then it remebers it has to follow the enemy on every frame.

The jitter is relatively minor but still looks bad.

Anyone know the reason?

49829-jerky.png

Its how you set up your widget. Get rid of the canvas panel on your widget. The canvas panel sets it to the screen space. I have noticed that it will move with AI or other objects if there is no input recieved but as soon as the player moves it locks in its position.

Removing the canvas from the widget will (let’s say Should) prevent this from happening.

-James

Hey,

I forgot to mention it but I do not have a canvas panel on that widget. It’s only the image. I figured that might be it as well so i removed it but sadly it still moves.

You could use a widget component, and set the Space property to Screen. The component will take care of all of this, just add the component to your enemy blueprint and give it the widget you want it to create. Then all you gota do is get the widget after the component creates it, and hand it any info, like access the the enemy actor and such so it can display the health.

The math you have wont work, you’re providing mouse in screen coordinates (but a different screen than the widget screen…too many screens). Any who, it’s providing the screen position in terms of pixels, where as the widgets need it in Slate units, which based on your current DPI scaling may be 1:1 to pixels, or completely different.

Thanks for clearing it up. Yea I already redid the part using Widget component shortly after posting the question but was still curios on the reason why it behaved like it did with this method.