I am trying to use a xbox controller for my fps.
I use the XBOX 360 Driver for Mac by Colin Monro
When i use the Joystick Test Program at:
http://www.rotorheadgame.com/unity/joytest.html
It says the Left/Right Triggers are 5th/6th Axis
NOT a ‘joystick button x’ (x being actual button number like 0 for fire)
I used the Input Manager to make another ‘Fire1’ Axis
Type: ‘Joystick Axis’
Axis: ‘Joystick 6th Axis’
Now first off since there is nothing i can put for button positive (because it only allows text like ‘joystick button 0’… cant enter ‘Joystick 6th Axis’ the GUI wont accept this) i am force to change my code from Input.GetButtonDown(“Fire1”) to Input.GetAxis(“Fire1”) > 0.0 to tell if the use press the fire button… The problem is that GetButtonDown only fire true in the FRAME that button was pressed in which great for a single fire thing (that is what i want) but for me to be able to use the trigger from the xbox 360 controller to fire a weapon (single shot for now) and since the ‘Button Positive’ wont take the value ‘Joystick 6th Axis’ i have to use GetAxis(“Fire”)
now this fires in every frame…
How can i only do my weapon fire code (Which instantiates a missle game object) for the frame the joystick button was pressed in (basically get the same functionally of the GetButtonDown but with a GetAxis so my weapon only fires once per trigger pull … not fire off 100+ missiles becuase i have the trigger held down and GetAxis(“Fire1”) > 0.0 will ALWAYS BE TRUE… Even on the way down of pulling the trigger and back up… WHEN the trigger is fully neutral is the ONLY time GetAxis(“Fire1”) will be less than or equal to 0)
So i need help in ‘tweaking’ the normal code used in the tutorials use GetAxis instead of GetButtonDown but all the features of GetButtonDown to ensure 1 shot per trigger pull or how do i make the Input Manager treat the trigger pull like a regular button fire…
Or any other info on how to use the XBOX 360 Right trigger to fire a weapon like the keyboard ‘Ctrl’ Key