I have a button that on press, activates the tick event, and on release, ends the tick event. In the tick event, i want to track the movement of the mouse cursor, and to test, I have the cursor/mouse location being printed in the tick event.
The issue is that clicking and holding the button, then moving the mouse/cursor does not update the location, it only records the cursor’s location on the button when clicked, and does not update the location during the tick event like I want it to.
Clarification: the mouse/cursor location is not updated when the mouse moves, but it is updated properly when the camera translates in world space. This leads me to believe that the “get mouse position” function is only being called before the tick occurs and is not updating properly, but I do not know for sure
If anyone could provide any assistance at all, I would greatly appreciate it.
Ok, did some testing. The mouse position is not updating because when you press the button the Widget gains focus of the cursor and not the Player Controller.
You can instead use the Get Mouse Position on Viewport node to access the mouse position on the widget
In my testing it successfully updates the mouse position while the button is pressed.
Basically while you’re interacting with the UI (widgets) they gain control over the inputs (you can override these using the Set Input Mode nodes). Since Get Mouse Position uses the Player Controller to get the Position, it’s getting the last known position before it lost the input.