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

**URL:** <https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314>\
**Category:** Community & Industry Discussion\
**Tags:** unreal-engine\
**Created:** [November 11, 2019, 4:30pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314 "2019-11-11T16:30:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarknessFX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/darknessfx/32/1194676_2.png) [@DarknessFX](https://forums.unrealengine.com/u/DarknessFX)\
**Post date:** [November 11, 2019, 4:30pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/1 "2019-11-11T16:30:24Z")

</div>

# Edit \> Plugins \> Add Windows Raw Input. Edit \> Project Settings \> Raw Input :

# Set Register Default Device True. Add 1 Device Configurations. VendorID 0x054C ProductID 0x05C4 Axis Properties \> Inverted True, Offset 0.5.

Edit \> Project Settings \> Input :  
Use Scale 2.0 for each GenericUSBController Axis.

# GenericUSBController config/events:

X - Generic USB Button 2  
] - Generic USB Button 1  
O - Generic USB Button 3  
/\ - Generic USB Button 4

L1 - Generic USB Button 5  
L2 - Generic USB Button 7 + Axis 8  
L3 - Generic USB Button 11

R1 - Generic USB Button 6  
R2 - Generic USB Button 8 + Axis 7  
R3 - Generic USB Button 12

LStick V - Axis 3  
LStick H - Axis 4  
RStick V - Axis 1  
RStick H - Axis 2

Dpad V - Axis 5  
Dpad H - Axis 6

# Share - Generic USB Button 9 Options - Generic USB Button 10 PSButton - Generic USB Button 13 TouchPad Click - Generic USB Button 14

https://i.imgur.com/R4a2M0Y.jpg

---

<div class="post-metadata">

**Author:** ![TerrorMedia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TerrorMedia](https://forums.unrealengine.com/u/TerrorMedia)\
**Post date:** [November 12, 2019, 2:54am UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/2 "2019-11-12T02:54:57Z")

</div>

Dude this is the best. I was just looking for this information recently but had put it on hold for a moment. This has saved me a nice chunk of time really appreciate it.

---

<div class="post-metadata">

**Author:** ![DarknessFX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/darknessfx/32/1194676_2.png) [@DarknessFX](https://forums.unrealengine.com/u/DarknessFX)\
**Post date:** [November 13, 2019, 1:04am UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/3 "2019-11-13T01:04:17Z")

</div>

I’m glad it’s helpful. I knew some UE4 PC games like CodeVein are able to detect and use DS4 (via USB) successfully, after a few tries with the RawInput plugin it actually did work and it’s not hard to add to the project.

---

<div class="post-metadata">

**Author:** ![AlexelTech](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexeltech/32/472737_2.png) [@AlexelTech](https://forums.unrealengine.com/u/AlexelTech)\
**Post date:** [November 20, 2019, 5:50pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/4 "2019-11-20T17:50:39Z")

</div>

Thank you for this post !  
I suppose there is no support for the Force Feedback functions with that type of generic profile ?

---

<div class="post-metadata">

**Author:** ![DarknessFX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/darknessfx/32/1194676_2.png) [@DarknessFX](https://forums.unrealengine.com/u/DarknessFX)\
**Post date:** [November 22, 2019, 2:23am UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/5 "2019-11-22T02:23:58Z")

</div>

I’m glad it’s helpful. Indeed, we don’t have force feedback using the RawInput plugin.

---

<div class="post-metadata">

**Author:** ![Alex174a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alex174a1](https://forums.unrealengine.com/u/Alex174a1)\
**Post date:** [December 4, 2019, 10:29pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/6 "2019-12-04T22:29:44Z")

</div>

Thanks a thousand times man! Now someone needs to write a plugin that would enable extra functionality like touchpad swipes, gyros, vibro feedback and lightbar.

---

<div class="post-metadata">

**Author:** ![DarknessFX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/darknessfx/32/1194676_2.png) [@DarknessFX](https://forums.unrealengine.com/u/DarknessFX)\
**Post date:** [December 5, 2019, 12:49am UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/7 "2019-12-05T00:49:00Z")

</div>

Yeah, that would be great to have, with support for the audio jack too. Sony Playstation is missing a good opportunity to release full driver support for DualShock4 on PCs.

---

<div class="post-metadata">

**Author:** ![Alex174a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alex174a1](https://forums.unrealengine.com/u/Alex174a1)\
**Post date:** [December 5, 2019, 7:01am UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/8 "2019-12-05T07:01:38Z")

</div>

> [@DarknessFX](#):
>
> Yeah, that would be great to have, with support for the audio jack too. Sony Playstation is missing a good opportunity to release full driver support for DualShock4 on PCs.

The thing is leaked PS4 SDK from 2017 gives an opportunity to do that already for 2 years.

---

<div class="post-metadata">

**Author:** ![Alex174a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alex174a1](https://forums.unrealengine.com/u/Alex174a1)\
**Post date:** [December 5, 2019, 9:08pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/9 "2019-12-05T21:08:23Z")

</div>

\*\*NOTICE \*\*- for those who had a second gen Dualshock 4, PID is 0x09CC

---

<div class="post-metadata">

**Author:** ![DarknessFX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/darknessfx/32/1194676_2.png) [@DarknessFX](https://forums.unrealengine.com/u/DarknessFX)\
**Post date:** [December 5, 2019, 9:21pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/10 "2019-12-05T21:21:52Z")

</div>

> [@Alex174a1](#):
>
> \*\*NOTICE \*\*- for those who had a second gen Dualshock 4, PID is 0x09CC

Good finding, thanks!

---

<div class="post-metadata">

**Author:** ![Alex174a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alex174a1](https://forums.unrealengine.com/u/Alex174a1)\
**Post date:** [December 10, 2019, 12:49pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/11 "2019-12-10T12:49:56Z")

</div>

**Notice 2**

You may notice that after setting up Raw Input with DualShock 4, controls in project will go crazy and will appear unresponsive. This is so because controller is simply sending too much data and Raw Input plugin simply glitching out because of it. You need to filter out this data like this: [Imgur: The magic of the Internet](https://imgur.com/sArtzfI) . Also, the buttons would took 4 to 6 times to press before anything happens.

---

<div class="post-metadata">

**Author:** ![Nerdsbeware](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nerdsbeware/32/897578_2.png) [@Nerdsbeware](https://forums.unrealengine.com/u/Nerdsbeware)\
**Post date:** [December 12, 2019, 10:57pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/12 "2019-12-12T22:57:17Z")

</div>

> [@Alex174a1](#):
>
> **Notice 2**
> 
> You may notice that after setting up Raw Input with DualShock 4, controls in project will go crazy and will appear unresponsive. This is so because controller is simply sending too much data and Raw Input plugin simply glitching out because of it. You need to filter out this data like this: [Imgur: The magic of the Internet](https://imgur.com/sArtzfI) . Also, the buttons would took 4 to 6 times to press before anything happens.

there is a fix for this in another thread about RawInput (sorry I don’t have the link). Sadly it caused the d-pad to not function, so maybe not the best fix, but if people want the link I can try to find it again.

---

<div class="post-metadata">

**Author:** ![Alex174a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alex174a1](https://forums.unrealengine.com/u/Alex174a1)\
**Post date:** [December 13, 2019, 8:39am UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/13 "2019-12-13T08:39:14Z")

</div>

> [@Nerdsbeware](#):
>
> there is a fix for this in another thread about RawInput (sorry I don’t have the link). Sadly it caused the d-pad to not function, so maybe not the best fix, but if people want the link I can try to find it again.

D-pad is recognized as another 2 axises - vertical and horizontal. Were the sticks functioning there?

---

<div class="post-metadata">

**Author:** ![Nerdsbeware](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nerdsbeware/32/897578_2.png) [@Nerdsbeware](https://forums.unrealengine.com/u/Nerdsbeware)\
**Post date:** [December 14, 2019, 1:19pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/14 "2019-12-14T13:19:29Z")

</div>

The sticks worked fine. I can’t seem to find the thread now, but basically it involved commenting out a line in the rawinput plugin. It 100% fixed the issue you mentioned (data overload, missed button presses, unresponsiveness), and everything was working perfectly. except d-pad would only detect up on the vertical axis, and nothing else.

when I get in front of my computer later, I’ll try to find it again.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a0389831](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a0389831](https://forums.unrealengine.com/u/anonymous_user_a0389831)\
**Post date:** [February 5, 2020, 7:47am UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/15 "2020-02-05T07:47:57Z")

</div>

Hi, thanks for the post. The big problem I am having is the button presses take way to long to register. You said it was a fix involving commenting out a line, what was it, or do you have the thread where they mentioned a fix?

---

<div class="post-metadata">

**Author:** ![Stooovie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Stooovie](https://forums.unrealengine.com/u/Stooovie)\
**Post date:** [March 23, 2020, 8:43pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/16 "2020-03-23T20:43:43Z")

</div>

Does this work on Mac too? I know Catalina is compatible with DS4 via Bluetooth and I do in fact have it properly recognized and connected, but even when I enable the Windows Raw Input plugin, it’s not in Project settings.

---

<div class="post-metadata">

**Author:** ![DarknessFX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/darknessfx/32/1194676_2.png) [@DarknessFX](https://forums.unrealengine.com/u/DarknessFX)\
**Post date:** [April 3, 2020, 5:07pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/17 "2020-04-03T17:07:17Z")

</div>

I don’t think it will work on Mac, the “Windows Raw” I think means it’s a Windows-only plugin.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_fab123f1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_fab123f1](https://forums.unrealengine.com/u/anonymous_user_fab123f1)\
**Post date:** [April 20, 2020, 12:40pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/18 "2020-04-20T12:40:53Z")

</div>

Does it work when connecting the controller via Bluetooth or are the inputs going to change?

---

<div class="post-metadata">

**Author:** ![Alex174a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alex174a1](https://forums.unrealengine.com/u/Alex174a1)\
**Post date:** [April 23, 2020, 10:23am UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/19 "2020-04-23T10:23:30Z")

</div>

> [@anonymous\_user\_fab123f1](#):
>
> Does it work when connecting the controller via Bluetooth or are the inputs going to change?

Man I wish BT connectivity worked as well but looks like RawInput requires a wired connection. Maybe if you alter the plugin it would be.

---

<div class="post-metadata">

**Author:** ![Nerdsbeware](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nerdsbeware/32/897578_2.png) [@Nerdsbeware](https://forums.unrealengine.com/u/Nerdsbeware)\
**Post date:** [May 15, 2020, 4:56pm UTC](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314/21 "2020-05-15T16:56:44Z")

</div>

Hi all. Thanks for your patience. Sincerely sorry for taking so long to get back to you on this. I’ve finally been able to find the post that I was able to use to solve the “unresponsive” button issue:

[http://answers.unrealengine.com/questions/583662/index.html](http://answers.unrealengine.com/questions/583662/index.html)

In RawInputWindows.cpp (around line 584 as of UE 4.22):

```auto

 [FONT=Helvetica Neue]DeviceButtonData.bPreviousButtonState = DeviceButtonData.bButtonState;
 

```

is redundant. From what I remember, (this was a long time ago I looked at it), it’s basically creating an infinite loop that continues til interrupted and floods the program with input. By commenting out that line, the inputs all worked perfectly and predictably with the exception of the d-pad.

Perhaps this line of code served some purpose related to the d-pad? My level in C++ is too low to really get it. But hopefully this will help someone more advanced than myself track down a more proper way to fix the issue.

[Next page](https://forums.unrealengine.com/t/tutorial-ue4-using-dualshock4-controller-via-usb-ps4-ds4-gamepad/133314.md?page=2)
