• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by wilco64256 · Jul 19, 2011 at 04:34 PM · inputmanagerxbox360

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!

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Chris D · Jul 19, 2011 at 09:17 PM 0
Share

@wilco64256 I agree with your point below but please don't post comments as answers. It makes it look like you're receiving more responses to your question and people will be less likely to give it a look.

I suggest deleting your answer and adding a comment here with it's text ins$$anonymous$$d.

8 Replies

· Add your reply
  • Sort: 
avatar image
-1
Best Answer

Answer by wilco64256 · Jun 01, 2012 at 09:20 PM

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.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image goodhustle · Feb 04, 2013 at 10:31 PM 1
Share

I can't get this or the Axis 8/9 working at all on Unity 4 or 3.5.6 - is this still operating correctly for you in Unity 4? If so, could you post a screenshot of your inputmanager and/or your Input calls that are returning true?

avatar image nventimiglia · Mar 25, 2013 at 06:27 PM 0
Share

Confirm. Axis 8/9/10 and Button 6/7 are a no Go. Button 6 maps to the back button.

avatar image thegreatzebadiah · Nov 09, 2013 at 03:54 AM 0
Share

I get axis 8 and 9 working...sometimes. It will often fail if I switch controllers, or the first time that I plug the controller in on a new computer. Re-running the executable or unplugging / replugging the controller seems to fix it, but if it's not dependable it's kind of a deal breaker. Looking into xinput now.

avatar image
2

Answer by kenruze · Jul 23, 2011 at 02:12 PM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by standardcombo · May 21, 2013 at 06:54 AM

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Maranasa · Jul 07, 2014 at 04:15 PM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hersheys72 · Feb 19, 2016 at 12:49 AM 0
Share

Thank you :)

avatar image
-1

Answer by wilco64256 · Jul 19, 2011 at 09:08 PM

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.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image testure · Jul 19, 2011 at 09:49 PM 1
Share

That may be true, but it doesn't change the fact that the controller is not designed to do that. For every game you name that has this functionality, I can probably name two that implement it poorly because it requires a lot of fuzzy logic to deter$$anonymous$$e the player's intention, not an actual state that the controller is in.

Take the new mortal kombat game for example- to activate the XRay move, you have to press both triggers together simultaneously. There are times where it doesn't work at all, because if the player manages to simultaneously press both buttons at exactly the same millisecond, the controller doesn't register any input. fact. They get around this by looking for 3rd axis 'jiggle' and the rest is just crossing their fingers. Overall it's not a terrible solution, but it could have been designed differently from the get-go. Which is my point.

I wasn't trying to imply that it's not possible, just not advisable. Use that information however you like.

avatar image testure · Jul 19, 2011 at 09:54 PM 1
Share

Just to prove a point- open up your joystick manager in windows and watch the "Z Axis" bar. When you press both triggers simultaneously, they 'jiggle' for a microsecond before returning to zero. This is because it's actually very difficult to press two buttons with different hands at exactly the same moment. $$anonymous$$ost games that implement this type of functionality capitalize on this to detect simultaneous input, but it's not foolproof.

avatar image wilco64256 · Jul 19, 2011 at 09:55 PM 0
Share

Yeah I'm not trying to make people press both at the exact same time, I just need to allow for them to do so if they want to. Like a player holding a gun in each hand should be able to fire both at the same time.

avatar image nventimiglia · Mar 25, 2013 at 07:14 PM 0
Share

Such apologetic logic is just annoying. They com$$anonymous$$gled the responsibilities of the triggers by binding them both to axis 3. Just another example of a $$anonymous$$icrosoft fail.

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Triggers on the 360 controller treated as one axis? 3 Answers

Can't get Triggers to Work [Solved] 1 Answer

Remote user game pads stuck on X axis, locally fine. 1 Answer

Xbox 360 controller support 1 Answer

Xbox Controller & input manager? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges