UMG x/y location button?

So I’ve tried many different approaches to make a particle system fire off at the point in which a user touches a UMG button. I’ve had issues rendering it on top of UMG so I had to create a widget specifically designed to render “images” like a particle system.

I’m stuck with the part where I try to determine the x/y location of the button that was touched. Since a button can be “slotted” in many different slots “parents” I do not know how to retrieve the absolute position of where it was touched. Sure, if the button is slotted in a canvas panel then I can use that slot to get the position. However, I have some buttons slotted into a Grid Panel and have no idea how to determine their locations at runtime =(…

How can this be achieved?

Now, I also tried to override the old Touched event in my level blueprint which is great since it shows the x/y location. However if the player touches a UMG button that event will not fire off since it was absorbed by UMG it looks like.

How can this be achieved???

Thanks,

Hey,

could you solve that problem already?

If not, you could try this:

Get the position of your mouse. That’s your screen space location. Then project the screen space location into world space, which yields the world location and the world direction at the screen space position. Then use the world direction and multiply it by 1000 (or something) add this vector to your world location and then you have a ray between the world location and the sum of those vectors (start and end point of the ray). Then you can use the ray in a LineTraceByChannel node. Set the trace channel to an own trace channel (you can specify them in the project settings under Collision) and add a blocker volume which blocks that trace channel.

This solution works great on PC… On Android it doesn’t work, though, because the mouse position is somehow substituted by a GetInputTouchState-node. The touch input node, however, never receives an input event, because the umg button consumes that input somehow. Haven’t found a solution for that yet. Maybe you have an idea?

I found the same error as you described and finally I found the solution too.

The button has a setting under “Interaction” category, it is called “Touch Method”.

I set it to “Precise Tap” and in the button’s “OnClicked” event, I can get valid data from “Get Input Touch State” method.

Hi! I am also trying to get a particle system to fire off at the point where a user touches a UMG button - would you mind sharing your knowledge with me, please? I just can’t seem to figure it out.

Many thanks in advance!


Edit: I am excellent at typos