Feature Request: Set Mouse Location

I would like more control over the mouse location, whether visible or not. We can get mouse location, but I would also like to set it. For instance, I am working on a tower defense game. When a player clicks on a tower, the camera pans to it, but the mouse stays in the same position, instead of recentering on it while the camera pans. I remedied this by making the normal mouse invisible and creating a cursor via hud and input from mouse delta. However now the mouse goes out of viewport and clicks on the applications in the background. This could be fixed by allowing me to set mouse location (if greater than viewportX, mouseX = viewportX) etc.

Hey PxRx0xDxIxGxY,

Thanks for making the request. I have logged this as UE-19589 to be taken into further consideration by our developers.

Let us know if you have any further questions, have a wonderful day!

I wanted to provide you with an update.

UWidgetBlueprintLibrary::SetMousePosition() already exists and it can only be used within the BlueprintImplementableEvent functions of UserWidget that have a return value of FEventReply.

As an example based on your AnwerHub question, we were able to override OnMouseButtondown/up in a UserWidget and have it use ‘Set Mouse Position’ node on the reply struct to successfully set the mouse position.

Hopefully this information helps you with the issue you were experiencing. At this time, we will not be exposing the applications SetCursorPos().

Thanks!

I can’t seem to replicate this in 4.11. Does anyone have an example?

If you’re having trouble with what we set up for OnMouseButtondown/up in a Widget, please let me know and I’ll provide you with some additional information.

If you’re trying to set up what PxRx0xDxIxGxY was trying, you will not be able to. As the feature request entered was not accepted because we’re not exposing the applications SetCursorPos() at this time.

Good luck!