Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Dazdingon · Nov 20, 2012 at 08:50 AM · inputjoystickgetaxis

Joystick input Problem

Hi. I have a problem with using Joystick in Unity.

Input.GetAxis() works perfectly with Keyboard input, but when i plug in a joystick, and Unity picks it up, it returns incorrect values:

  • When centered the Horizontal value returns -1 when it is supposed to return 0.

  • When I move the axis to the right it goes from -1 to 1.

  • when I move the axis to the left it JUMPS to 1. (supposed to go from 0 to -1)


I use this code to test it:

 var Horizon : float;
 var Vertica : float;
 
 function OnGUI () {
     GUI.HorizontalSlider(Rect(50,20,200,25),Horizon,-1,1);
     GUI.VerticalSlider(Rect(20,50,25,200),Vertica,1,-1);
 }
 
 function Update () {
     Horizon = Input.GetAxis("Horizontal");
     Vertica = Input.GetAxis("Vertical");
 }



Both my joysticks work correctly in other games, but fails to do so in unity.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by swiftcoder · Dec 27, 2012 at 10:22 PM

You have the sensitivity set too high. It defaults to 1000 - open up the input settings and change it to 1.0 for each of your joystick axes.

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
0

Answer by Dazdingon · Mar 12, 2013 at 12:05 PM

Hi, I have not worked with joystick inputs since this question.

I have found something interesting though.

When I used a xbox remote. It all works fine.

I assume different controllers work differently with unity's input system.

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
0

Answer by Paul_Smith · Mar 08, 2015 at 05:41 PM

I'm having the same issue with my Thrustmaster Top Gun Afterburner stick and throttle. I wrote a VB.NET program to test getting the imputs directly and all the numbers are correct. I translated that program to C# and put it in a unity script and it returns 0 (zero) for all impute.

Note: It requires winmm.dll to work and I put a copy of that in the plugins folder.

I think Unity's connections to the windows joystick drivers has a bug in it based on the fact that all other games and programs do not experience this issue with the inputs being screwed up.

Paul

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 BL4CKF0X · Mar 11, 2019 at 03:07 PM 0
Share

Hey there!

Did you solve the bug with your controller? I'm having a similar issue as Dazdingo, but I cannot replace my controller, because I have to work with it for my bachelor thesis...

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

12 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

Related Questions

Steering Wheel / joystick GetAxis trouble 0 Answers

joystick movement 2 Answers

Input.GetAxis returning nonsensical values for HID Sensor/GameController 0 Answers

Map mobile joystick to Input.GetAxis("Horizontal") and "Vertical" 1 Answer

Get DPad input value via GetButton instead of GetAxis? 8 Answers


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