Gamepad Triggers not working
I'm trying to make it so when I press the right trigger it will shoot a bullet, the only problem is that it doesn't register the input from the trigger, I already tested it and it works fine if you use a mouse but if I try to switch it over to the trigger it won't shoot. Here is the code:
{ public Rigidbody bulletPrefab; public Transform barrelEnd;
void Start ()
{
}
void Update ()
{
float primaryAttack = Input.GetAxis("FireGun");
if(primaryAttack >= 1)
{
Rigidbody BulletInstance;
BulletInstance = Instantiate (bulletPrefab, barrelEnd.position, barrelEnd.rotation) as Rigidbody;
BulletInstance.AddForce (barrelEnd.forward * 5000);
Debug.Log("it works");
}
}
}
and here is the input settings I used:
Gravity = -1000
Dead = 0.2
Sensitivity = -1000
snap = true
Type = Joystick Axis
Axis = 10th Axis
Joy Num = Joystick 1
Your answer
![](https://koobas.hobune.stream/wayback/20220612081751im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Trying to get controller to trigger OnTriggerEnter, no avail 0 Answers
FPS Controller 0 Answers
Why doesn't Input.GetButtonDown() work with my ps4 controller? 0 Answers
detect rotation direction (clockwise or counterclockwise) from touch drag gesture or swipe. 0 Answers
Need help with animator!! 0 Answers