Draw Material - Header is not centered to the target

Hello everyone

My goal is to draw a header centered on a target at my screen. Thanks to Peter L. Newton’s amazing asset Advanced Targeting System I was able to achieve part of my goal.

So, my problem now is that whenever I get too far from the target, it loses it’s center point, making it not accurate.

Pics:

9dc81317a0b73f95b27bd296fbd40bcae4a65c7c.jpeg

dca31f3eca28c05064008941b276f16da0207f4e.jpeg

So, basically I’ve transposed an actor’s location to coordinates of the screen and checked if it’s not outside of the Visible screen. Then, called Draw Material node.

If anyone has experienced this before, please share your thoughts :slight_smile:

Cheers!

Hey Gbr!

I was hit with this same issue a few times when I first started learning UMG (Which I believe is what you are using).

Basically the pivot location for the image drawn is at X=0 Y=0, which means the pivot its on the top left. As you can see in the images, if you draw a box around it, you might be able to see that the top left corner will be at the same location in all the pictures.

Two solutions, you can “Set Pivot” of the image to be X=0.5 Y=0.5 (To center the image, and this would be the easier option), OR you can offset its position by half of the width/height.

Hope this helps!

Yes! Made it work following your logic but for the Material position. Before you send the X and Y coordinates, you must subtract the value of the Screen Width * 0.5 (Pivot offset) to X and subtract Screen Height * 0.5 to Y. This way I got it centered :slight_smile:

Thanks a lot!!