Can I use BP to add a HUD element when the crosshair is over a player (like their name)?

Hi all!

I’m in the ShooterExample example, and I’m trying to use blueprints to add a HUD element when the crosshair is over a player (like a players name.)

I’d like to try and do this using Blueprint, but I know all the functionality of example this is in the code. My questions are, can I:

A) Reference the code in Blueprint (for example to get the aiming trace function to detect when it hits a player, and display the name.)

or

B) Just do this entirely in Blueprint anyway with no mind to the code.

Any starting points would be welcome. Thanks!

Howdy!

Short answer is yes, you should be able to this through Blueprints. You could probably have a TextRenderComponent as part of the Character’s Blueprint that displays the given name over the player’s head (hidden by default).

Tracing, you could probably then determine if another player is mousing over them at which point you could unhide the TextRenderComponent (client side only) so that they are the only that sees the name pop up. You’d have to take a look at the Networking Blueprint Tutorials but I’m sure it could be done.

-W

Hi Wes, thanks.

In the FPS examples, is the cursor in the center of the crosshair (hidden I’m sure?)

I’m fairly certain, otherwise you can trace from camera too. Theoretically, this all should be possible although I haven’t given it a go yet.

Hi!

I know you have already accepted an answer, but I’m going to show you what I have anyway. I finished this yesterday, so I haven’t had much time to test it. Still, it’s a starting point!

Level Blueprint:

Macros:

I noticed mine is a little bit off from the crosshair (just a few pixels) but it’s good enough. Also, you can change that circle trace to a line trace or whatever you feel like.

Beautiful! Thanks so much.

I’ve been poking around all day now. I managed to get a trace drawn from center screen to report back when it hits a player, but your way is a little different from mine and a little cleaner. Thanks.