XBox 360 Pressing both Triggers Simultaneously

So I’ve seen people ask this type of question before but I don’t see an actual solution to this problem anywhere and am wondering if there is one. I saw one person mention that you could maybe list the triggers as actual joystick buttons instead of referring to them as 3rd axis, but I’m unclear on how to set that up in the actual input manager so I can use it. The 3rd axis method just doesn’t seem to work because pressing both triggers at the same time resets the entire axis to 0. I really have to be able to press both triggers at the same time. Thanks for any help or suggestions!

I’ve discovered that the analog triggers actually do have their own separate axes. If you make a build of your game as a standalone, you can configure input axes at launch. The triggers give axis 8 and 9. The axis numbers are zero based there, and they are start at one in the input settings in the editor. If you could access controller axis 9 and 10 in the editor, you could get the trigger inputs separately from the start.

So axes 9 and 10 are the Xbox 360 controller’s trigger inputs as separate axes for the standard Windows driver. You just can’t access them without the user binding them; and only in a standalone build.

pretty frustrating.

I don’t know what you guys are doing wrong, but Axis 9 and 10 work perfectly for me. I was stuck on the 3rd axis problem for a bit. Unity version 3.5.6f4

Actually he’s right, 9 and 10 work. but you need to use them as you would any other axis.

What I mean is you need to store the input form axis 9 and 10 into a float and use that float as the conditional for the commands you a trying to do.

Here is an example script… lets assume you want to fire “shot1” when you press the right Trigger (axis 10) and fire shot 2 if you press the left trigger (axis 9) or fire both shots at the same time.

first set up you inputs in the input manager like this (leave blank any boxes i don’t give you the info for)

--------…

name : Fire1

Gravity : 0

Dead : 0.19

Sensitivity : 1

Type : Joystick Axis

Axis : 10th axis (Joysticks)

Joy Num : Get Motion from all Joysticks

--------------AND…

name : Fire2

Gravity : 0

Dead : 0.19

Sensitivity : 1

Type : Joystick Axis

Axis : 9th axis (Joysticks)

Joy Num : Get Motion from all Joysticks

----------------------OK NOW THE SCRIPT ITSELF…

using UnityEngine;
using System.Collections;

public class Guns : MonoBehaviour
{

public float fireRate1;
public float fireRate2;
public Transform shotSpawn1;
public Transform shotSpawn2;
public GameObject shot1;
public GameObject shot2;

private float leftTrigger;
private float rightTrigger;

private float nextFire1;
private float nextFire2;
void FixedUpdate () 
{
	leftTrigger = Input.GetAxis ("Fire2");
	rightTrigger = Input.GetAxis ("Fire1");
	if (rightTrigger > 0.1f && Time.time > nextFire1)
	{
		nextFire1 = Time.time + (fireRate1 * Time.deltaTime);
		Instantiate(shot1, shotSpawn1.position, shotSpawn1.rotation);
	}
	if (leftTrigger > 0.1f && Time.time > nextFire2)
	{
		nextFire2 = Time.time + (fireRate2 * Time.deltaTime);
		Instantiate(shot2, shotSpawn2.position, shotSpawn2.rotation);
	}
}

}

I hope this helps. I am pretty new to all this myself but I tested this and it works for me.

I found this thread on the forum that might be able to help. Actually, a general google search will probably put you on the right track.

thanks :slight_smile:

Axis 9/10 doesn’t seem to function properly with supporting more than one xbox controller.

In my experience, they crosstalk and you actually need to move BOTH left or right triggers (if you plug in two controllers) and it’s exact interaction seems to be very inconsistent.

Except triggers aren’t joysticks - they’re separate buttons by themselves. There are plenty of games out there where you can press both at the same time to shoot multiple weapons at the same time or do other simultaneous things. If they weren’t meant to be pressed at the same time then the controller should be physically designed so that they can’t be pressed at the same time. It has to be possible.

I should have updated this some time ago, but at least I am now - somewhere along the way Unity was updated such that it now reads these two buttons separately with the left trigger reading as button 6 and the right trigger as button 7. It also reads both buttons pressed at the same time no problem.