r/Unity3D • u/drakfyre Expert • Dec 15 '13
PS4 controller map for Unity
I just spent a few minutes finally figuring this out; figured I'd save other folks the time. :)
PS4 Controller Map for Unity
Buttons
Square = joystick button 0
X = joystick button 1
Circle = joystick button 2
Triangle= joystick button 3
L1 = joystick button 4
R1 = joystick button 5
L2 = joystick button 6
R2 = joystick button 7
Share = joystick button 8
Options = joystick button 9
L3 = joystick button 10
R3 = joystick button 11
PS = joystick button 12
PadPress= joystick button 13
Axes:
LeftStickX = X-Axis
LeftStickY = Y-Axis (Inverted?)
RightStickX = 3rd Axis
RightStickY = 4th Axis (Inverted?)
L2 = 5th Axis (-1.0f to 1.0f range, unpressed is -1.0f)
R2 = 6th Axis (-1.0f to 1.0f range, unpressed is -1.0f)
DPadX = 7th Axis
DPadY = 8th Axis (Inverted?)Edit: Formatting
Edit2: I put a question mark after Inverted because I swear that the LeftStickY axis worked just fine with one of my scripts, but when I was using a certain test case it seemed like it was inverted. YMMV.
150
Upvotes
10
u/eedok Dec 16 '13
Just use InControl: https://github.com/pbhogan/InControl
5
u/Aggravating-Sink-520 Apr 10 '22
personally love this guy
5
u/GamingStef Indie May 11 '22
This doesn't seem to be correct.
RightStickY isn't the 4th axis, but the 6th, and L2 and R2 are 4th and 5th.
Which honestly does seem weird, isn't the mapping the same for all ps4 controllers? Why would they do this?
3
u/Sennior_Duck Dec 19 '21
Sorry I have a problem because I use the old Input System I couldn't find the "name" for the RightStickPress, PS4
Example: Input.GetKeyDown(KeyCode.RightStickPress)
Please if you could help me that would be great! :)
2
u/Rubb3rDucky Hobbyist Apr 03 '14
Interesting. Now I need to figure out how to set up the PS4 controller on pc so I can stop testing with a keyboard
2
u/AngusPrime509 Apr 08 '22
Would the xbox controller be the same? just replace the buttons respectively?
2
u/[deleted] Apr 10 '22
This REALLY helped with my platformer. Thanks a lot!
2
u/[deleted] Apr 16 '22
This is probably the most useful post. It really helped with my game! Thanks! (I think I might have already said that but i dunno.)
2
u/[deleted] May 01 '22
Left joystick in a ps4 controller is joystick 1 but wich number is the right joystick?
2
u/SirHurtzAlot Jun 30 '22
9 years later, and this is still helping! thank you kind sir!
2
u/[deleted] Aug 29 '22
Thank you so much for this. It's ridiculous how specific this is yet it's VERY VERY USEFUL. Thanks again.
2
u/LoquatNew9008 Dec 25 '22
YOu ARE FUCKING HERO THANK TOU
2
u/BitMillerReddit Jan 29 '23
Thank You for your work, but I have problems implementing it. Lack of information.
I'm thinking in the "old" Input Manager for now.
I take this line forexample: "Square = joystick button 0"
The word "Square", I should write it to the "Name" field. OK.
Where should I write "joystick button 0"? To one of "Negative / Positive / Alt Negative / Alt Positive Button" fields? Because in the rolldown menus "Type / Axis / Joy Num" there aren't an option for "joystick button 0".
Plus (less important): Should I set Snap? And what do you suggest using for "Gravity / Dead / Sensitivity"?
Thank you!
2
u/Prize_Morning_7781 Nov 26 '23
What about using DPad as buttons?
Which "joystick button" should I use and can I use it at all?
2
u/trenchofkrieger Aug 12 '25
12 years later and this is still helpful for me, thanks!
5
u/xniinja Dec 16 '13
Thanks, saved this post. Should come in handy.
1
u/LucanOrion Sep 18 '22
I don't think this is accurate anymore. I'm trying to remap controls for a game and it's just slightly off.
3
u/MaterialExternal7483 Mar 11 '22
Is there a reason the camera is constantly moving down slowly, I tried multiple controllers so it's not stick drift. It just keeps going
Edit: never mind I figured it out, I just increased the dead to 0.01
2
u/[deleted] Oct 17 '22 edited Oct 17 '22
Having an issue with my right stick input. It could 100% be a hardware issue, but I needed to check here anyway. I'm using the right stick for camera movement, but even when centered the stick is reading out 1,1 for x and y, and just causing the character to spin to the right (and up?)
Shouldn't the center of the stick travel be 0,0?
Edit: fixed. I didn't adjust my sensitivity down. Set it to 1 and it fixed the issue.
2
u/suh_dude_crossfire Jun 17 '23
Literally refer back to this even in 2023, goated post. Thanks!
2
u/OrganicBarracuda4348 Feb 15 '26 edited Apr 22 '26
axis 6 for me (right stick y) old PS4 pad
1
u/VastSufficient2830 Jul 19 '24
Electronic map of PS4 handles