[Tutorial] UE4 using Dualshock4 controller (via USB, PS4 DS4 Gamepad)

Does anyone know how to make this work without messing up input for every other game controller? When I setup inputs for the PS4 controller, every other controller gets messed up. It’s basically this bug report Unreal Engine Issues and Bug Tracker (UE-66123)

Try to change “Set Register Default Device” to False.

Thanks so much for this tutorial! I’m using UE 4.25.3 and Windows RawInput 1.0. I got this working with slightly different values than the original post, and I think it’s because either my version of UE or RawInput is newer than when this was originally posted.

In my Edit > Project Settings > RawInput, there’s a option for each axis called “Gamepad Stick” which makes things very easy. Also my ProductID is 0x09CC (the documentation for RawInput Plugin shows how to find this).

Here’s all my settings under Edit > Project Setings > RawInput in case it helps someone else. I’ve also included what each axis and button maps to for me. For me the Dpad V & Dpad H are both on Axis 5 with nothing on Axis 6.

Vendor ID: 0x054C
ProductID: 0x09CC
Axis[0]:USB Axis 1 - RStick V Inverted: Yes
Gamepad Stick: Yes
Offset: 0.0

Axis[1]:USB Axis 2 - RStick H Inverted: No
Gamepad Stick: Yes
Offset: 0.0

Axis[2]:USB Axis 3 - LStick V Inverted: Yes
Gamepad Stick: Yes
Offset: 0.0

Axis[3]:USB Axis 4 - LStick H Inverted: No
Gamepad Stick: Yes
Offset: 0.0

Axis[4]:USB Axis 5 - Dpad V & H Inverted: No
Gamepad Stick: No
Offset: 0.0

Axis[5]:USB Axis 6 - doesn’t do anything Maybe it’s supposed to be the touchpad area?

Axis[6]:USB Axis 7 - R2 trigger axis (also Button 8) Inverted: No
Gamepad Stick: No
Offset: 0.0

Axis[7]:USB Axis 8 - L2 trigger axis (also Button 7) Inverted: No
Gamepad Stick: No
Offset: 0.0

[HR][/HR]
Button[0]: USB Button 1 - Square
Button[1]: USB Button 2 - X
Button[2]: USB Button 3 - O
Button[3]: USB Button 4 - Triangle
Button[4]: USB Button 5 - L1
Button[5]: USB Button 6 - R1
Button[6]: USB Button 7 - L2 trigger (also Axis 8)
Button[7]: USB Button 8 - R2 trigger (also Axis 7)
Button[8]: USB Button 9 - Share
Button[9]: USB Button 10 - Options
Button[10]: USB Button 11 - L3
Button[11]: USB Button 12 - R3
Button[12]: USB Button 13 - PS
Button[13]: USB Button 14 - Touchpad Click
[HR][/HR]
One thing that was really helpful to figure the axis values and mapping was to open the game console (press the [FONT=Lucida Sans Unicode]` (backtick) key) and type [FONT=Lucida Sans Unicode]showdebug input

2 Likes

Paste to notepad and save as .ini and inport to Edit > Project Settings > RawInput by click Import button


[/Script/RawInput.RawInputSettings]
DeviceConfigurations=(VendorID="0x054C",ProductID="0x09CC",AxisProperties=((Key=GenericUSBController_Axis1,bInverted=True,bGamepadStick=True),(Key=GenericUSBController_Axis2,bGamepadStick=True),(Key=GenericUSBController_Axis3,bInverted=True,bGamepadStick=True),(Key=GenericUSBController_Axis4,bGamepadStick=True),(Key=GenericUSBController_Axis5,Offset=-1.140000),(Key=GenericUSBController_Axis6),(Key=GenericUSBController_Axis7),(Key=GenericUSBController_Axis8)),ButtonProperties=((Key=GenericUSBController_Button1),(Key=GenericUSBController_Button2),(Key=GenericUSBController_Button3),(Key=GenericUSBController_Button4),(Key=GenericUSBController_Button5),(Key=GenericUSBController_Button6),(Key=GenericUSBController_Button7),(Key=GenericUSBController_Button8),(Key=GenericUSBController_Button9),(Key=GenericUSBController_Button10),(Key=GenericUSBController_Button11),(Key=GenericUSBController_Button12),(Key=GenericUSBController_Button13),(Key=GenericUSBController_Button14),(Key=GenericUSBController_Button15),(Key=GenericUSBController_Button16),(Key=GenericUSBController_Button17),(Key=GenericUSBController_Button18),(Key=GenericUSBController_Button19),(Key=GenericUSBController_Button20)))
bRegisterDefaultDevice=True

I still not find a way to set the Dead Zone values for RAW Input.

1 Like

Ok, I just figured out how to set the Dead Zone values:

1.png

I just input this logic on all Event Axis of my Character Blueprint:

2 Likes

I dont think RawInput has a deadzone feature. I made a blueprint function that does deadzone

Yeah, I was able do to do like my previous post, and also I was able to put support “native” for DualShock 4 and DualShock 3 using the RAW input, for DualShock 3 I’m using the official driver from Playstation Now PC version.

I wasn’t able to get RawInput working for me (steam was somehow messing it up), but I did add UE4Editor.exe to steam library, then launched it from steam. I connected my ps4 controller via bluetooth, set the configuration specifically to the “gamepad - ps4 controller” and it recognizes my controller. Might have issues with a build version, but I can at least work in editor for now.

This was really helpful!

One additional thing that made things simpler for me to support both PS4 and non-PS4 controllers - when you’re setting up the RawInput, you can modify what “Key” each Axis or Action gets interpreted as. That way, you only need to set up “Gamepad Left Thumbstick Y-Axis” or whatnot and it will work for both PS4 and XBox controllers. I also didn’t need to set an offset for any of my axes, and only inverted for the Left Thumbstick Y-Axis.

Here’s what mine ended up looking like:

Hi folks,
Thanks for all the great info sharing here. For some reason, the minute I play the game, the character will run forwards and to the right ignoring any controller input. In fact there is no input form controller whatsoever. Am I doing something wrong here?
I checked the Vendor & Product ID and they are the same as you guys mentioned.
The controller is definitely plugged in and Windows can read the movements. Furthermore, the controller works fine when I use DS Windows App btw.

@M0rph3u5_UK Same for me. I even unplugged the controller after I hit play, and the character kept moving. When I go to the windows game controller test configuration, Nothing comes up or it crashes. Controller works great in Rocket League. I think something is odd with my drivers. In fact, I did a 1000hz mod for Rocket League, maybe that did something with the drivers. I tried to undo that 1000hz mod, but still didn’t work in UE. I’m on my laptop with 4.26.2. I’ll be back at my desktop in a couple weeks and I’ll try there again.

Thanks, this worked for me!

Although now I have an issue, which is that for some reason the D-Pad isn’t being properly recognized. Up, Right, and Down all belong to the same axis for some reason, and Left is not recognized at all.

Has anyone resolved this?

Hi , i try and paste your BP into my project also , seem not sure how to use it and i got error on deadzone local and axis local , i’m kinda new to UE could you take some time to explain me how to manage em plz.

Hi folks! There is a Windows DualShock plugin avaliable now. If I activate it I still need to make this?
I read that this plugin simulates Xbox Controller using PS4 DS4 controller.

2 Likes

Update: I’ve noticed that when I pull back or try to go Right on the game pad Axis, I get no input what-so-ever.

Hi, First post here. Anyway, I have the DualShock plugin enabled, but, I’m still having massive troubles with the gamepad input.

As soon as I launch my game, my character immediately moves forward and toward the right. I’ve messed with the configuration of RawInput, even reset everything to default. Nothing is resolving this issue, other than to disable the USB Input Controller in the Input configuration, and then, of course, I have no game pad functionality.

At first I thought that maybe it was the generic gamepad controller I bought, but after purchasing the DualShock4, I’m still having the same problem. I’m using the DS4Windows application on Windows 10 Pro. When testing the inputs through Windows, everything works as it should.

@Cmdr.Kokoro @M0rph3u5_UK I’m having exactly the same issue here. Using RawInput makes the player pawn immediately run forward and turn right in the Third Person Project and makes the spaceship dive down and spin right on the Flying project template. I’ve also tried using DS4Windows, but that has no effect whatsoever.

It does seem a bit of a shortcoming where an industry-standard controller just doesn’t work with the engine.

Having the same issue as the last few people as well.
Turning on the ‘Gamepad Stick’ options, removing the offset, and setting the axis scale to 1.0 seems to do the trick.
I left the inverted raw input option off as well and just invert them on the actual inputs when needed.

I’m having the same issue with the Dpad. The entire dpad is detected as Axis5, not very useful as I’d expect it to be detected as 4 buttons. Has anyone figured out how to make use of the Dpad?

Anyone figure out how to get the Dpad working properly with a PS5 controller? I can only get up on the Dpad to work, no input from the other 3 buttons.