Download

Widget Component Health Bar issue

I have a widget component with a progress bar that floats over my actors. The widget component is set to screen size.

The issue is as I move away from my actors the health bars get massive and take up most of the screen. As I get closer the health bar gets smaller until it’s the correct size I have it set to.

How do I stop the health bars from auto scaling with the camera. I am using the third person blueprint template.

thanks for any insight.

  1. post some screenshots of your widget setup, ill check it out.
  2. That health bar, is increasing truly its size on your screen, or only relative to actors? Because i had problem with relative bar size to actors but i solved it by dynamically changing size, i can post you my bp setup if its that.

Up close
5e1e821942a5148feb16db155936c7057f05729b.jpeg

Far away
1d732c4fbaa6a0d61b03e8748cd820f9c25e6ede.jpeg

The widget setup is just a progress bar set to size 400x20 and centered. The widget component has no other defaults changed other than the mode set to screen space and the widget set to my plate widget with the progress bar in it.

Ye i had same problem which disgusted me so i created something like this:

It is not fully set and there are missing something (if target teleport away, his HP bar will be wrong-sized)… but its good point where to start i think with these HP bars… im gonna do them with this way in my game probably…
script is placed in “enemy character” bp

Thanks for posting that. I was hoping there was just some setting I was missing so I would not have to resort to dynamically resizing based on player location. It would be nice if it just scaled the exact same way the actor scales when far away instead of doing the opposite.

It is possible do exactly how do you want to do it, in widget options in character blueprint, set widget draw to world space, that should auto-scale that hp bar (widget -> user interface -> space -> world)

Ah i tried that but then it faces the wrong direction and disappears etc. So i guess in that case i have to rotate to face the camera all the time?

yes, then you need to rotate that hp bar towards player, in tick… i think it is possible to draw bar to screen and auto-size it, but i not found that option yet or it needs some c++ programming