How to get weapon wheel to work with gamepad thumbstick

Hello everyone,

I have been struggling with getting a solution.

My current issue is getting a gamepad to work with my weapon wheel. My weapon wheel is a widget that consists of 6 Check Box widgets.

I then have this widget set inside of my master widget.

I want to have the player press and hold the left face button on the gamepad to open the weapon wheel and navigate the segments with the left thumbstick. If they release the left face button the weapon wheel disappears / is no longer active.

What I have works on mouse and keyboard. Press and hold tab and with the mouse, select the segment for the weapon.

When I use a controller I have attempted putting the Set Keyboard Focus and Set Focus nodes when the weapon wheel is activated. However, this causes the weapon wheel to immediately close. I can prevent this issue if I change opening the widget to a pressed input instead of it being a hold input but even doing that presents me with issues. When I change it to a pressed Input the focus never gets set to the weapon wheel. I have tried putting the focus nodes in the player character and in the widgets but the widgets never get focused when using the controller.

Any guidance or tutorials to have the player hold the left face button and use the left thumbstick to select the wheel segment would be greatly appreciated.

Also let me know if need to provide any other information for better understanding of what I have implemented. Ty!

ENHANCED INPUT ACTION IN CHARACTER BLUEPRINT


INPUT MAPPING CONTEXT FOR WEAPON WHEEL

WEAPON WHEEL WIDGET WITH HIERARCHY

WIDGET WORKING WITH MOUSE AND KEYBOARD

So, I was able to get the thumbstick to work for the weapon wheel by using the thumbstick to control the mouse position.

CONTROLLING CURSOR W/THUMBSTICK
gif

BP FOR ACTIVATING WHEEL & SETTING CURSOR POSITION

CONTROLLING MOUSE CURSOR WITH THUMBSTICK

All though it’s not what I hade in mind it’s working with the exception that the cursor can trail of the wheel.

Does anyone know if it’s possible to limit the mouse position to circle? Something like below?

SKETCH FOR LIMITING CURSOR MOVEMENT WITHIN A CIRCLE

I was able to find a solution. I’ll leave it here for any possible future passers.

First, in my attempt of restricting the mouse movement in a circle, I came across this article by Cody Albert.

https://dev.epicgames.com/community/snippets/2WeN/unreal-engine-umg-widget-radial-cursor-clamp

This clamps the cursor in a circle and at first worked great but it actually didn’t work when i used the gamepad to move the cursor.

So I changed my approach and went with what’s probably a lot less cleaner and efficient but still worked.

I got the atan 2 in degrees of the controller’s left thumbstick and clamped that in a range. Rounded the value to put in a Switch and based on the position set the mouse at the relative segment of the wheel. It’s not the cleanest and possibly not as efficient but I’m sure if someone else does come across this they’ll be able to tweak and adjust it to make it better.

GET THE ANGLE OF LEFT THUMBSTICK

CLAMP THE ANGLE OF ATAN TO A VALUE OF 12 - 0. INT VALUE INTO A SWITCH

LOCATION OF THE WHEEL SEGMENTS ON VIEWPORT

SET LOCATION OF MOUSE BASED ON INT VALUE

FUNCTION FOR SETTING MOUSE POSITION BASED ON THUMBSTICK ANGLE

The clamped Out Range value was an arbitrary value based on what felt the most responsive when testing.

END RESULT
Gif2