UMG custom hit box on a button or image

Hello,

Is there any way to make a custom hit box on a button, or other Widget control?

I have an image of a button that has the following shape

85789-customhitboxbtn.png

And I’d like the hitbox to be exactly the shape of the image, not a rectangle. Is this feasibile?

Thanks.

Try using this: https:/// download link is in description to the video.

Thank you very much! I didn’t think that anyone would answer this after all this time :slight_smile:

I’ve found a bug there. Haven’t solved it yet. For it’s been working correctly, try to keep button’s size and hit box image size equal. And set button’s size manually.

I found a fix for that bug you mentioned. All you need to do is change the BufferPosition calculation to floor the LocalPosition.Y value. The decimal point has no meaning in texture coordinates and it’s giving you the wrong pixel. So it should look like this:

int BufferPosition = (floor(LocalPosition.Y) * ImageWidth) + LocalPosition.X;

With this fix you can have a button size that doesn’t match the texture size.

Any one else having issues getting this to work with 4.20. I am getting a bunch of linker errors

Anyone else having compiler erroa when trying to use in version 4.20 of ue4?