Set position of a widget

Hello,

i want to set the p]osition of a widget over the head of my Player, but it doesn’t work… I presume that “getactorlocation” is always empty. can anyone help me?

it’s a 2d-Sidescroller…

The simplest method of doing this is to add WidgetComponent to your character blueprint. It will always stay with your character. Although you may need to perform some logic to keep it facing the camera correctly depending on what your doing with it.

Thanks for your answer!!

But it seems that i described my problem not exactly enough… so thats i wanna do: After my Player picked up an item (on component hit Tomate => then destroy component “tomate”) a widget over the head of my Player should appear (create “collected it” Widget => then set Position in Viewport) and disappear after some seconds. It’s not something like a healthbar wich is always following my Player. By the way now i am sure that “getactorlocation” has the right values (checked with “print string”) but perhaps it don’t transfer to “break vector”?

To compute the location of a widget in 2D space from any 3D world location, use the ProjectWorldLocationToWidgetPosition node.