- Home /
Using Controller Triggers in input
What I have been doing all day is trying to figure out how to use an xbox controller, I have mapped all the button, but the triggers will not work at all. I am trying to make it so when I pull the right trigger, I attack.
I have this
if(pickedUp && Input.GetButtonDown("Attack")){
attack();
}
Now I cant seem to get the input manager to setup right. I have the Attack input look like this Name: Attack Gravity: 1000 Dead: .001 Sensitivity: 1000 Type: Joystick Axis Axis: Ive tried 3rd 10th and everything else.
I've looked up everywhere on trying to do this, and I am stumped
Answer by MrSoad · Nov 03, 2014 at 02:08 AM
Use :
if (pickedUp && (Input.GetAxis("Attack") > 0)) {
not
if(pickedUp && Input.GetButtonDown("Attack")){
If your name in the Input Settings is "Attack Gravity" then you need to use that exact name above, not "Attack"!
Also depending upon which trigger you want for attack you may need to swap the "> 0" for "< 0". The triggers are mapped to the same axis on axis 3 and will cancel each other out to 0 when both pressed fully. You can split them onto two separate axis, 9 and 10 maybe(look it up as I cannot remember exactly off the top of my head).
Oh try these settings for your input as well :
Gravity : 0
Dead : 0.19
Sensitivity : 2
Your answer
