Announcement

Collapse
No announcement yet.

How to get reference of all player character

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

    How to get reference of all player character

    I have a health bar 3d widget attached to the character and the widget is set to screen space cause I need to see the health bar trough walls but here is my problem,
    I want to set the health bar position and scale relative to the distance between players but how do I get ref of all player character present in the game so I can get distances to set the widget scale and position.
    the health bar actually is going high above the head at long distance and the scale stay the same whatever the distance.
    Anyone know how to do this?
    Last edited by brahoule; 07-21-2018, 07:04 PM.

    #2
    I recently had something similar and I transfered the WidgetComponent reference to the UserWidget, from there you can get the location of the 3DWidget and compare it to the location of the local playercontroller.

    Comment


      #3
      Originally posted by FrostyElkArne View Post
      I recently had something similar and I transfered the WidgetComponent reference to the UserWidget, from there you can get the location of the 3DWidget and compare it to the location of the local playercontroller.
      Hey thanks for the reply! I'm not sure if I understand correctly … can you show me a code example?

      Comment


        #4
        I see now that I answered in the BP forum, my solution was done mostly in C++. But basicly I have both a derived WidgetComponent and a derived UserWidget, where the WidgetComp sets its reference in the UserWidget. The UserWidget then have access to the WidgetComponent and can calculate the distance.

        Comment

        Working...
        X