I was wondering if there is a way to get distances between players in multiplayer so I can use it to set the scale the player healthbar?
The healthbar is set as screen space and i want to scale it down relative to the distance between players.
I think it doesn’t matter whether it is multiplayer. Just Subtract the Location of the player’s Camera from the Location of the healthbar or the pawn it’s following, and then get the Length of the resulting difference vector, and that will tell you how many Unreal Units of distance away it is.
well, maybe it DOES matter whether it is multiplayer because then you can’t scale a healthbar toward one player and then hope it looks good to all the other players.
I don’t know the best approach for this but what I decided to do was to for each Pawn, create a healthbar for each player that is on the local machine (so this thing I’m doing only runs on each client), and then setting its owner to the player that will be viewing it (not to the player it’s describing the health of), so I can set OnlyOwnerSee to true on that healthbar. So each pawn has a healthbar following it around for one of the other players, and another for another player, etc. Then you can scale each one individually.