# Example for controlling mouse cursor with thumbstick in UE5

**URL:** <https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643>\
**Category:** Blueprint\
**Tags:** unreal-engine, UI\
**Created:** [July 20, 2022, 7:55pm UTC](https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643 "2022-07-20T19:55:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RabbitHoleAvert](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RabbitHoleAvert](https://forums.unrealengine.com/u/RabbitHoleAvert)\
**Post date:** [July 20, 2022, 7:55pm UTC](https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643/1 "2022-07-20T19:55:24Z")

</div>

Prompted by a marketplace question I decided to try combining thumbstick and mouse control for cursor UI in a project. This quick blueprint approach shows one way to do it:

1. Under the **Edit** drop-down menu, I went to **Project Settings \> Engine \> Input \> Bindings \> Axis Mappings** and added an Axis Mapping for a controller left thumbstick Y-axis (I named it _ThumbstickY_) and likewise I added an X mapping and named it _ThumbstickX_.

(If anyone is not familiar, **ACTION mappings** are bindings for on/off inputs like button presses, mouse-clicks, etc, while **AXIS mappings** are bindings for analog/variable inputs like mouse movement, joysticks, steering wheels, etc.)

1. With those two mappings I added this script to a blueprint:

 ![AddThumbstickToMouse_UE5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/a/51aeb2b180be5262977bc1452319d7aad6ffb791.png)

Whenever input from the thumbstick is enabled, its input will be added to the mouse position. This means the cursor can be operated by either mouse or thumbstick (or both).  
This can be improved on, and I think some mouse nodes are different in UE4, but hopefully it’s a helpful example.

(The _event_ and _get_ nodes that have _ThumbstickX_ or _Y_ in the name are calling the name of my axis mappings. If you used a different names then search for nodes of those names)

As you can see, it just handles cursor movement. For mouse clicking, you would create an Action-mapping and eg if using a _ **Widget Interaction Component** _ you would connect the Action-mapping to the _ **Press Pointer Key** _ node when pressed and _ **Release Pointer Key** _ node when released.

---

<div class="post-metadata">

**Author:** ![kashyyyk1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kashyyyk1/32/88707_2.png) [@kashyyyk1](https://forums.unrealengine.com/u/kashyyyk1)\
**Post date:** [July 22, 2022, 12:30am UTC](https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643/2 "2022-07-22T00:30:36Z")

</div>

Worked great! Also to test, I had add to disable movement in the demo because I kept moving out of the trigger box, and with the right thumbstick, you look all over as the mouse moves. But will be great in gameplay, because it won’t be trigger boxes opening it. Thanks!

---

<div class="post-metadata">

**Author:** ![nan0\_0nan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nan0_0nan/32/562238_2.png) [@nan0\_0nan](https://forums.unrealengine.com/u/nan0_0nan)\
**Post date:** [August 25, 2022, 10:02pm UTC](https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643/3 "2022-08-25T22:02:05Z")

</div>

Picked up the Top Down Shooter asset that was on sale on the Marketplace and can confirm that it works with it and on UE v4.27 as well. I just added the Axis Mappings and put the code into the character BP. Thanks RHA.

---

<div class="post-metadata">

**Author:** ![Shuantheone](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shuantheone](https://forums.unrealengine.com/u/Shuantheone)\
**Post date:** [April 9, 2023, 4:29am UTC](https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643/4 "2023-04-09T04:29:41Z")

</div>

Hey, Just Ttried this and everything works great except my mouseY axis is flipped, any suggestions? NVM I JUST HAD TO SET THE MULTIPLY VALUE TO NEGATIVE FOR THE Y EVERYTHING WORKS NOW THANKS!

---

<div class="post-metadata">

**Author:** ![TimSweeneysMutt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TimSweeneysMutt](https://forums.unrealengine.com/u/TimSweeneysMutt)\
**Post date:** [January 12, 2024, 2:15am UTC](https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643/6 "2024-01-12T02:15:39Z")

</div>

Any chance we could get a blueprint visual of that mouse click explainer you included in the last graf? Would love to visually see how that’s set up for a complete “Xbox controller=mouse” menu solution.

Also–I followed the thumbstick-to-cursor steps and now my cursor drags itself down to the bottom right corner of the screen automatically–why is that?

---

<div class="post-metadata">

**Author:** ![Galvanicus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Galvanicus](https://forums.unrealengine.com/u/Galvanicus)\
**Post date:** [June 13, 2024, 9:00pm UTC](https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643/8 "2024-06-13T21:00:18Z")

</div>

That drag is probably the deadzone that is slightly off.  
In the input action, you can either add a parameter for deadzone OR in the input axis, make both X and Y abs, add them together and if below a threshold, ignore it. I found mine to be 0.15 .

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/a/b6ae3831c7ec44707c2f2622298b3fa135d795bb.png)

My issue with this is that I get inconsistent results.  
If I start the game, the first movement I make, will move the cursor and then stop BUT there is now an invisible cursor moving around.  
I have to continuously move the cursor and the gamepad to get a consistent cursor following.

The Mouse click is unfortunately broken up until 5.2 apparently. But I think it looks like this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/f/eafe98820aaf433205dffd02cb4f582a5da5e4d9.png)  
It didn’t work for me and I’m in 5.1 but I cannot take the risk to go to 5.2 currently.

The workaround for the clicks is to have all your buttons set focus when hovered over and then the focus portion of the UI will take care of the input. Which is dumb…

---

<div class="post-metadata">

**Author:** ![Mihai.e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mihai.e](https://forums.unrealengine.com/u/Mihai.e)\
**Post date:** [March 9, 2025, 10:33am UTC](https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643/9 "2025-03-09T10:33:10Z")

</div>

Your solution is great @RabbitHoleAvert, but I would add to it some things.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/2/182b506be96aaf27822963ead9b563fe6285171d.png)  
For my game this was the approach and I want to say that I only use the mouse as UI navigation. For others this approach could not work.

If someone is asking why the !=, is because when you alt+tab and want to use your mouse in desktop, it gets stuck. This happens, because the ue project keeps running in the background the code.

---

<div class="post-metadata">

**Author:** ![Cronoss95](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cronoss95/32/887902_2.png) [@Cronoss95](https://forums.unrealengine.com/u/Cronoss95)\
**Post date:** [March 13, 2025, 9:25pm UTC](https://forums.unrealengine.com/t/example-for-controlling-mouse-cursor-with-thumbstick-in-ue5/609643/10 "2025-03-13T21:25:38Z")

</div>

I am really curios on how to do this: I have a 3d menu, but even though I can control my cursor now, I cant seem to activate the widgets via the controller button. Am I missing something here?  
When I hover my mouse cursor over the widget, press my left mouse button and then press x on my controller, it works. But I cant activate the widget just via the x button from my controller…

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/2/2/f22b9a86052e55ecfcb5a9ca4b6fb56670481060.png)
