I want to create a Dynamic Grenade HUD.

I want to create a Dynamic HUD that only tells the direction of a grenade like the screenshot in the example when the grenade falls within a certain radius of the player character. How should I implement it?

It’s just math for the most part.

The way I see it, when any player throws a grenade, he should generate a Grenade Thrown event. All the other players are subscribed to that event and as soon as the event is called, the grenade tracking function starts executing on tick.

First you check if the grenade is within the radius. Next, if the grenade is within the field of view. If it is, you just get the grenade position on the screen and add the respective icon to the HUD with certain offset from the grenade position.

If the grenade is behind the player, you calculate the Delta between the player Forward Vector and the Find Look at Rotation (player => grenade) angle to know if it’s to the right or left, and position the grenade icon at the left of the right edge of the screen.

As for the grenade icon I’d combine two images: 1st - the grenade image that will remain upright; 2nd — the pointer, with the image center located where the grenade icon is, and the pointer itself offset a bit to be able to rotate around the grenade. And then let’s say that if the grenade is in the right half of the screen (or behind the player to the right), the pointer icon should be to the right of the grenade icon, and vice versa.

When the grenade explodes, it generates another event that disables the grenade tracking (if there are no other grenades thrown).

Agreed, that should do it.

In case it’s useful, I just helped answer a similar question where I showed some examples of how you’d set up a widget that points at an off-screen actor and stays constrained along the edge of the screen. You could easily adjust the idea to keep the widget closer to the screen center, if desired, and to include an icon along with the arrow as Tuerer described.

Here’s the other question with related information. (Scroll down toward the bottom to find the UMG-related stuff.) Hope it helps.