Announcement

Collapse
No announcement yet.

Making healthbar widgets same size regardless of distance from character

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Making healthbar widgets same size regardless of distance from character

    My character TestPawn1 lets you hit a key and create widget components for the enemy characters "TestChars" and then sets them to a health bar widget. My problem is that the widgets' size will change depending on how far my character is since and don't remain a static size on my screen like I'd like them to. Should I be scaling the UI elements an amount based on my character's position relative to the enemy characters?

    Thanks.

    #2
    Originally posted by Cswic View Post
    My character TestPawn1 lets you hit a key and create widget components for the enemy characters "TestChars" and then sets them to a health bar widget. My problem is that the widgets' size will change depending on how far my character is since and don't remain a static size on my screen like I'd like them to. Should I be scaling the UI elements an amount based on my character's position relative to the enemy characters?

    Thanks.
    Yes, since you're using a 3D widget, the perceived size of the health bar will keep changing just as with any object in the game world. If you want to use a static size, you have two options:
    1. Change the widget scale based on the distance to the player camera, or
    2. Change the Space parameter in your 3D widget component from World to Screen. By rendering it at screen space, you will always have a constant size.
    In both cases, you will also have to adjust the relative location of the health bar widget from it's owning enemy character based on distance. This is because while a static size widget takes the same amount of screen space, the enemy characters start taking lesser and lesser until eventually the widget starts overlapping/covering the character at long distances.
    Last edited by Stormrage256; 08-09-2019, 02:04 AM.
    Unreal Possibilities
    Grid Creation Systems | Tower Defense Starter Kit | Line of Sight Visualization

    Comment


      #3
      Originally posted by Stormrage256 View Post

      Yes, since you're using a 3D widget, the perceived size of the health bar will keep changing just as with any object in the game world. If you want to use a static size, you have two options:
      1. Change the widget scale based on the distance to the player camera, or
      2. Change the Space parameter in your 3D widget component from World to Screen. By rendering it at screen space, you will always have a constant size.
      In both cases, you will also have to adjust the relative location of the health bar widget from it's owning enemy character based on distance. This is because while a static size widget takes the same amount of screen space, the enemy characters start taking lesser and lesser until eventually the widget starts overlapping/covering the character at long distances.
      Thank you, that was exactly what I am looking for. That has fixed the look of the health bars and gotten closer to what I had in mind.
      Last edited by Carock12; 08-09-2019, 02:44 AM.

      Comment

      Working...
      X