Hi
I am trying to get the triggers to work on my xbox controller so I can use them to use my attacks in my game. I have heard that they are axis and I have tried putting in all this like joystick axis , axis e.t.c but nothing works. So how can I make so my primary attack uses the right trigger and my secondary attack uses the left trigger?
Thanks in advance!
Go to Edit - Project settings - Input
Create new element, set the name to PrimaryAttack, or whatever you want, select type Joystick Axis, Axis - 9th axis, Joy num - 1st or Get motion from all Joysticks. Positive, negative and alt buttons should be empty, gravity and sensivity - 1000, Dead around 0.2, snap must be ON (this way you will always get only 1 or 0 values, but not between them, like 0.5.
Then in your code you did this:
float primaryAttack = Input.GetAxis ("PrimaryAttack");
And if it’s not 0 - make your attacking code.
Repeat all the above steps for SecondaryAttack, but use 10th axis.
OR you may use 3rd axis for both of your attacks, but you will get value from -1 (left trigger) to 1 (right trigger)
Also check this article, because there are some differences between OSes:
http://wiki.unity3d.com/index.php?title=Xbox360Controller
For different OSes you may create several items in input setting with same names, say PrimaryAttack for each OS (3 of them with different axises for each - win, mac and linux).
Hope this will help.