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.
62 comments · 99% upvoted · other discussions
Left joystick in a ps4 controller is joystick 1 but wich number is the right joystick?
drakfyre [OP] 2 points · May 2022 · Expert
It's 3rd and 4th axis. The "Joystick #" is for when you have multiple controllers connected, it's not an axis for a stick.
(So they'd both be Joystick 1 for a single-player game.)
[deleted] 2 points · May 2022
Thanks! Really helped me out, I was trying with every controller number lol
drakfyre [OP] 1 points · May 2022 · Expert
No problem! :> If you have other questions please ask, I'm pretty familiar with Unity.
[deleted] 1 points · May 2022
I just tried it and it still doesnt wor, the y axis is 3rd for me and i havent figured the x, i dont know if it has something to do with my camera script, it might be wrong