Control Mouse Cursor with Gamepad Joystick

I haven’t. I’m going to get some lunch and then rectify it, however. RAMAFTW!!!

Ah lunch. Excellent idea.

I found this: https://forums.unrealengine.com/showthread.php?1987-Converting-2D-to-3D-Space, but its a little beyond me (at least so far).

Ahh bummer on the plugin. I haven’t tested it yet, been wrapped up in other things. The more I think about it, though, the more I like the deprojection method for this problem. Granted, I’ve never used that particular node, but I’ve used the project node a good bit - it should work the same way. You’ve already got screen X and screen Y info and then you could use the worldposition output as the end of your line trace. Give that a go.

Deproject.gif

Here is the unsuccessful version so far. The deproject is not updating screen X and Y based on a variable float input.

This is coming off the event tick on a HUD blueprint I created. I’m ending it at the location I want it to go to test and see if the cursor is moving the trace. “Cursor X” and “Cursor Y” are variable floats I added to the end of the “Move Widget” section. They are the exact same variable float that are the translation inputs on the widget to move it around.

Hrmmm… unless I’m misunderstanding the big picture, you’d want deproject in the end result, right? Something like this:

I mean yea, But i was just doing it the other way to check and see if my cursor x and cursor y were updating it. They are not. I did just switch it around to deprojecting the end. But I’ll need another way of getting the cursor location in screen x and y.

Gotcha. Basically, you need the opposite of set position in viewport.

Correct, only “set position in viewport” doesn’t update, it is a fixed position, or at least that is what I ran into while trying to update my cursor widget location. I ended up using “set render translation”

Yes, set position in viewport needs to be hooked up to “event receive draw HUD” in your HUD BP. It’s basically an event tick. I use it to position health bars in 2D space for enemies running around the world.

Ah! Didn’t realize that, but it makes sense.

Got this from RyanB on epic staff. Haven’t had a chance to work on it any though.

"I think I have done that before but the exact method isn’t coming to me right now but I think it will come to me soon.

In terms of how to interact with the scene, you may want to look at the “Content Examples” player pawn. You simply do a line trace from the cursor into the world using the camera vector and then you can do “break hit result” on the line check and do different things based on different actors. What I usually do there is use an Interface system to communicate. Then you can easily have items that contain their own logic entirely.

Ie you could have an “Interact” interface, and when you click something in the world, it passes the interface message to the hit actor. The interface would have a reply boolean, and if the actor clicked implements the interface, the pawn would get the reply and set a local variable for “interaction actor”… then you can pass input from the pawn to “selected actor” and then have the selected actor decide when to deselect itself/whatever. Basically that would be another interface sent back to the pawn saying selection is done, and the pawn would set some boolean like “Object Selection = false” and then set “selected actor” to none. You could also use the “IsValid?” macro on that selected object variable to avoid needing a boolean."

GamePad UMG Plugin

Dear OP,

I made a plugin that allows using a gamepad like a mouse in UMG menus, Epic’s Nick Darnell who made UMG in the first place did the code, I wrapped it in a plugin for you all to enjoy:

Thank you Rama and Nick, this looked confusing to me (limited programming knowledge) but it was actually easy and works SO Great!!