Convert Mouse Location To World Space doesn't work?

For turn based game I need to measure distance between a character and mouse cursor in real time. To make thise I use EventTick and ConvertMouseLocationToWorldSpace. But it doesnt work properly because this funktion take a coordinates of the centre of screen instead of a mouse cursor coordinates! So, if I move mouse - the coordinates dont varia, but if i move a camera - then the funktion measure distance between a character and the new center of the screen.
The qwestion is: how to measure the distance between a character and mouse cursor in real time?

Did you make the mouse visible?

The *Convert Mouse Location To World *node works pretty well but there’s no need to get it involved here, try this:

As a bonus, if you opt for *Get Hit Result Under Cursor for Objects *instead, you can start filtering collision right there for more control over what you’re measuring against.



Thanks a lot for the answer.
But I have more question. I need use the distance measuring only in combat and translate that distance into Action Points, and then put it into software cursor widget. I try do it, and Action Points calculete correct, but cursor widget spawn on the centre of the screen and cursor dont chenge.
How it should to do correct?

Try it like this:


And in the widget:



I did so, but did not create a Custom Event Update Cursor Data - Aren’t the variable dont update in widget without Custom Event?

Now it works, but only while the cursor moves. When the cursor stops, it disappears. Why is this happening?

This is inefficient, why cast every frame? Push the data into the widget directly. It will work, of course, it’s just not recommended.

Most likely because you’ve assigned a widget in the Project Settings. Either do it there or do it manually as suggested above. Not both. For example, whenever the cursor turns into CardinalCross, it will spawn the assigned widget and override the one you created.