How to move widget with gamepad

This is defeating me.

Here’s the breakdown: I want to a cursor I can move with my gamepad. I tried to control the mouse position with the controller and got nowhere. Below is my progress, or lack thereof. In “event begin play” I’ve created the widget. I add it to the viewport and try to make the controller work with it here.


The set position is only called when the cursor is spawned (according to the function names)
Placing it on the Event Tick might work for what I think you’re trying to do

Tried that. No such luck…

Tried that, no such luck

The thumbstick value, does it return -1 to 1? If so, multiplying the position might not be what you want to do.
An addition multiplied by the thumbstick may work better.

Also, you can try SetRenderTranslation to see if that will work at runtime instead?

Edit: I have confirmed that SetRenderTranslation works, where SetPosition does not

I believe you are right about the thumbstick. I switched to addition, and tried the render trans, but still no luck. I also set the location initially so it would have a location to move from.

Try using Debug Draw String on your Get Gamepad Right Thumbstick values, they maybe too small (multiply them by a ‘speed’ value and by Delta Time from Elapsed Time).
GetPosition would also probably never change, you’ll want to use get transform and break out the translation.

Edit: something like this (in pseudo-code)

Event Tick(Delta)
Speed = 10
Curor->SetRenderTranslation(GetRenderTransform().Translation + Vector2D(ThumbX, ThumbY)DeltaSpeed)

I believe I tried that (starting to get a little beyond my understanding). Here’s the results (which didn’t work). As a point of consideration I am doing this in the character blueprint. I also tried it in the widget blueprint but that didn’t work either. Although that could just be because I set it up poorly. I don’t have time now, but I will have to look up how to use the debugdrawstring, haven’t used that before.

The multiplications should come before the addition (you want to scale the axis result before adding it to the current position)

You can try passing a random number instead of your gamepad input to see if the rest of the code is working too

I can’t see what is linking to branch, is that event tick?

I’m heading home for the night, let me know if you make any progress!

Right, so made some big progress. Its still to working how I want it to, but I can move the widget with the gamepad thumbstick now. WOOT! I pulled in the axis values directly from the input event, multiplied by 20000 (cursor speed) and it kinda works now. And yea its pulling from event tick. Its super jerky, seems to have a boundary (like it won’t let me push the widget past a certain point), and automatically jumps back to its original location as soon as I release the thumbstick. Here’s a link to a video of what it looks like, and below is the current blueprint.

My money is on ‘Get Position’, I’ll wager it doesn’t change but you’d probably want it to.
If you change it to GetRenderTransform:Translation and lower the 2000, I think it might work

You my friend are a genius. That works perfectly.

My to do list from here:
1 - Removing any camera rotation while I am in this menu and moving the cursor around
2 - Being able to tell that its in the circle so I can use it to charge up the box and spawn a particle system
3 - Setting custom boundaries to contain the widget
4 - applying random force to the widget to make it hard to stay in the circle
5 - figuring out a way to “click” with it so I can use this same system for my menu.

I won’t have time to work on that till this evening though. I’ll post any more problems I run into though.

Seriously thank you.

As far as being able to tell if its in the circle, I made a collision sphere that is set in the circle and I’m guessing some sort of line trace from the widget to detect collision?

So far this isn’t working. Haven’t had time to piddle long though.


Any ideas on how to do a proper line trace from a moving widget? This is one (of many) examples of what didn’t work.