How can I Draw a Hitbox Based on Image Location?

Hi there! Is there any way I can Draw the Hitbox of a HUD using the image location (Image = Text that says ‘‘Exit Game’’

The logic works but I can’t offset the hitbox properly.

Unfortunatly This is the exact setup that I use currently. I still can’t click my buttons.

I also use the same setup as the content example in the Event Graph.

Hey Moggeh2k,

In Epic’s Content Examples they have a menu in their HUD presentation. Here is a snippet on how they draw their buttons. This would be similar to how you draw your images with Hit Boxes that offset properly.

Peace

Just to cover our bases. Do you have the events to receive the Hit Events set up properly? Here is something also included in that example to changes the “Pressed” bool variables.

Yes, I have double-checked and my layout in the other sections are 100% the same.

So the Hit Box is not exactly over your texture? It somewhere set incorrectly, but still clickable. Did you change your camera settings at all?

As of now its not even near. I can’t find it anywhere I click on the screen either. But I have offset the Text boxes that should have hitboxes, so if only there was a way to make the location of the hitboxes exactly the same as the location on the Text boxes it would work perfectly. Right now I have the offset of the hitboxes that the Content example provided but if I click anywhere in the middle of the screen no commands get entered (In other words: Exit, Resume etc)

I keep probing it, and its difficult to understand what entirely may be going wrong without having it for myself. So I have a few suggestions for you. Instead of only dividing the screen by half. Try also dividing the x by 5 after, so you don’t need to do -1000 x on the first offset.

Another suggestion would be to modify the Draw Button function to match your needs because by default the Hit Box size 256x128 is twice the Size of the Texture being drawn. Are your buttons that size as well?

I found the Answer. The problem was the buttons being too large in the Alpha Channel of my images. Apparently UE4 draws Hitboxes from Alpha as well as the image itself.