I use the xbox 360 controller for my game and I want set the LT for aim and RT for fire. Works fine when I not press LT or RT at same time. But both Buttons at same time doesn’t work because LT and RT uses the same axis (3rd axis), LT (-1.0) and RT (1.0), when I press both buttons at same time I get a value of 0 (1 -1=0).
LT + RT is by microsoft definition of the DirectPlay drivers for the X360 Pad a value of 0 actually. (Microsoft defines LT as 0 to -1 and RT as 0 to 1 on the same axis in DirectInput - Only in xinput they show up as distinct axis)
so there is no problem to fix, its correct.
its your code logic that requires fixing or you need to use the XInput .NEt assembly available for Unity to use the x360 controller that way
Using a virtual axis won’t do it. The driver that microsoft provides for the Pad on windows for DirectPlay (or for “not XInput”) enforces them to be on the same axis, no matter what.
The XInput extension is really the way to get there, its freely available, so no worries on that end
If you’re using 2 separate virtual buttons for them and you only need to know if a virtual button is being pressed, then use Input.GetButton instead of Input.GetAxis.
EDIT: Actually, let me do some research regarding this since it’s a tad interesting.
Really interesting. With XInput it works !! I get 2 different values when I press LT RT at same time. I think this is a unity Input problem with virtual keys.
No its no Unity bug, virtual key problem or anything alike.
As mentioned above, thats a Microsoft thing. Microsoft decided that the DirectPlay drivers, used for anything but XInput, don’t offer the buttons on seperated axis, instead they map to the same axis with LT from 0 to -1 and RT from 0 to +1.
Unity can’t do the slightest bit about it as unity only gets the final input value from the driver and thats already the sum of the buttons