Widget Scaling at Distance

Let’s have a look at how does it work in my project
Here is the enemy’s pawn with a widget setup. Pay attention that I cast enemy’s widget and send ref of owner’s pawn


1a-enemy pawn

Then in the widget’s graph itself, I use this ref to get any variable that is needed (here you can call the pawn’s location)


And here is the widget designer, I anchored the HP bar on the center of the screen. Here are progress bar sizes X and Y that you can change on the fly

I don’t know how you implemented such HP bars on all pawns but you just need to have

  1. Enemy’s pawn ref → get location (vector)
  2. Camera’s pawn ref → pull out camera component → get location (vector)
  3. Distance between two vectors → distance value(float)
  4. Some logic that will change the progress bar’s size in the widget accordingly to the float value