如果要Unity PS4的左右两摇杆,那么需要配置好你的Input的Name, Type, Axis, Joy Num
Name:你自己定 Type:Joystick Axis Axis:查看下表 Joy Num:自己定用哪个
然后代码中Input.GetAxis(“NameHere”)就可以了
如下两个图:
Input设置 那么这个Move_1的就是手柄1(Joystick 1)的左摇杆的垂直值了 水平值得可添加一个Axis改为:X axis的就好了
之前查了好久都不知道是哪个轴,蛋疼,还好下面的References中的国外小哥分享了
详细的Axis表(我还是抄过来吧,也方便自己浏览)
PS4手柄部位轴名(Axis)值范围Left Stick X-AxisX Axis-1 to 1Left Stick Y-AxisY Axis1 to -1Right Stick X-Axis3rd Axi-1 to 1Right Stick Y-Axis6th Axis1 to -1DPAD X-Axis7th Axis-1 to 1 (0.64 with multiple buttons)DPAD Y-Axis9th Axis-1 to 1 (0.64 with multiple buttons)L1joystick button 4R1joystick button 5L2 as Buttonjoystick button 6L2 as Axis4th Axis-1 to 1R2 as Buttonjoystick button 7R2 as Axis5th Axis-1 to 1Left Stick Clickjoystick button 10Right Stick Clickjoystick button 11Touchpad Clickjoystick button 13X Buttonjoystick button 1O Buttonjoystick button 2Square Buttonjoystick button 0Triangle Buttonjoystick button 3Share Buttonjoystick button 8Option Buttonjoystick button 9PS Buttonjoystick button 12 References- PlayStation 4 Dual Shock Controller Input Mapping with Unity on Windows 10
- Xbox360Controller 可能需要科学上网