Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
0
Question by ZeroRadius · Aug 02, 2017 at 02:43 AM · inputmanagerinput managerxbox controller

Xbox Controller RT Button does not revert to 0 until other input is applied (some times)

Hello, I am trying to use an Xbox 1 controller to control my game via the "Input manager". I have set up the "RT" button on the controller to freeze the Y axis. It seems to work well 50% of the time but if I press the button quickly or if I hold it in, it sticks when I release it (Debug.Log confirms it is reading that the RT button is being held in). I thought that maybe the buttons were sticking so I tried the LT button and got the same thing. If I set it to Axis 5 or Button 1 I do not get the problem. I still don't think that both buttons are sticking because A)The character starts behaving normally once I press/move any other button or joystick B) it's a new controller and those buttons do not stick in the few games I have tried with it .

The attached image shows the settings in the input manager: alt text

And here is my code:

 //Code that does not effect this has been removed for readability 
 private void GetInputs()
     {
         if (PlayerControlsEnabled)
         {
             this.Horizontal = Input.GetAxis("Horizontal");
             this.Vertical = Input.GetAxis("Vertical");
             this.Jump = Input.GetAxis("Jump");
             this.RT = Input.GetAxis("RT");
         }
     }
 
 //Code that does not effect this has been removed for readability 
 //Note rb2d  is a RigidBody2D
  public void MovePlayer()
     {
         
         if (this.Horizontal > 0) //Move Right
         {
             this.transform.eulerAngles = new Vector2(0, 0);//Flip player to face the right
             if(this.rb2d.velocity.magnitude <= this.MaxNormalSpeed)//Don't excede the max speed
                 this.rb2d.AddForce(Vector2.right * this.ForwardForce * Time.deltaTime, ForceMode2D.Impulse);
         }
         if(this.Horizontal < 0) // Move Left
         {
             this.transform.eulerAngles = new Vector2(0, 180);//Flip player to face the left
             if(this.rb2d.velocity.magnitude <= this.MaxNormalSpeed) //Don't excede the max speed
                 this.rb2d.AddForce(-Vector2.right * this.ForwardForce * Time.deltaTime, ForceMode2D.Impulse);
         }
         if (this.Jump > 0) //Jump
             this.rb2d.AddForce(transform.up * JumpForce *Time.deltaTime);
         if(IsFlying)
         {
 
             if (this.Vertical > 0)
                 this.rb2d.AddForce(transform.up * this.FlyingUpwardForce * Time.deltaTime);
 
             if (this.RT < 0) //If Right Trigger is pressed apply air breaks
             {
                 this.rb2d.constraints = RigidbodyConstraints2D.FreezePositionY;
             }
             else //If Right trigger is not pressed remove the air breaks
             {
                 this.rb2d.constraints = RigidbodyConstraints2D.None;
             }
         }


inputrt.png (17.6 kB)
Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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.

Follow this Question

Answers Answers and Comments

67 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 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 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 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 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 avatar image avatar image

Related Questions

Using Trigger Keys on Xbox Controller To Zoom 2 Answers

Active input handling with input sytem 0 Answers

Is there a way to detect a change in Control Scheme with the new Input System? 1 Answer

create default and customizable inputs 0 Answers

Input Manager settings not working with XBox One controller 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