- Home /
Xbox controller triggers for Input Mangaer
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!
The triggers are indeed axes. I'm not sure which they are since I always use the InControl plugin for controllers.
Answer by curiouspers · Mar 03, 2015 at 03:12 AM
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613184808im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to get trigger input on an Xbox controller (Mac) 0 Answers
How can I get trigger input from an Xbox controller? (Mac) 0 Answers
How can I get trigger input from an Xbox controller? (Mac) 0 Answers
Can't click gameobject when over another trigger? 1 Answer
How to get individual trigger input using Xbox 360 controller? 3 Answers