Health Bar Moving with Enemy

Hello,

I have a few enemies on the screen, and I want each to have a health bar stay above their head wherever they move on screen.

I’ve tried adding a 2d billboard to the character, scaling it as health changes, but its only scaling from center despite trying to make a sprite that pivots from left. It also has translucency issues (But I assume I could solve that). I imagine I could do it with a thin rectangle mesh as well, but that doesn’t feel like the best way. In either case, if I wanted to expand beyond a simple scaling rectangle for the HUD, it would get much harder to do, (laying out text renders and 2d billboards in a nice manner).

Now I am wondering if UMG is the way to go? I admit I’m just starting with UMG, but it seems like it’s mean to work in screen space mainly and I haven’t found an easy way to do something like this.

So, I am wondering what the best way to do about making UI elements (for now non interactable, but in the future maybe both) that move with an actor? 2d billboard or static mesh? Or should I be using UMG or something else entirely?

Thanks.

Create a UMG widget, set its size at the top right hand side of the editor to a fixed size (rather than full screen) and draw your health bar within it.

Now go into your actor and attach the UMG widget to the actor, positioning it above their head. You can use the “Find lookat rotation” blueprint to update the UMG on a timer to always face your player’s actor.

There are some tutorials relating to this on YouTube which were helpful when i did this myself: Unreal Engine 4 Tutorial - 3D Health Bar (NPC's) - YouTube - Part 1 and 3D Health Bar Part Two (Rotation) - YouTube - Part 2.

Hope this helps!