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 myingling · Nov 09, 2013 at 10:31 PM · inputscaleaxis

Input.GetAxis returning only -1, 0 or 1, nothing between

I'm trying to use a PS3 controller (though the MotioninJoy Tool, so it appears like an Xbox 360 controller) and everything is working fine, except the joysticks are only offering three values: -1, 0, 1. My problem: I want a half-push to trigger 0.5, a quarter to trigger 0.25, etc. I believe the docs say they're supposed to work this way, so I'm not sure what I've done wrong.

Here's the code (the only bit which listens for the joystick input) and prints it:

 function Update () {
     
     Debug.LogWarning("J1V: "+Input.GetAxis("J1V"));
     Debug.LogWarning("J1H: "+Input.GetAxis("J1H"));
     Debug.LogWarning("J2V: "+Input.GetAxis("J2V"));
     Debug.LogWarning("J2H: "+Input.GetAxis("J2H"));
 
 }

I mapped J1V to the left joystick's vertical axis and the others according to the stick and axis, accordingly. (Hence than name "1V", mapped via Edit->Project Settings->Input, mapped "J1V" as Type:Joystick Axis, Axis: Y axis, Joy Num: Get Motion from all Joysticks.)

I know that it works since these warnings do print, but they print only print -1, 0 and 1. Actually, instead of 0 they print 0.0142733. Not sure if it matters, but worth noting.

Any ideas of what could be causing my scale to intermediate values? Thanks!

Comment
Add comment · Show 2
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 RyanZimmerman87 · Nov 09, 2013 at 11:24 PM 0
Share

So does the motionInJoy force the values to like .25 and .5 like you were saying?

Are you getting .01427 for when it should be 0? That's pretty darn close sounds like your joystick might be a little off or maybe that kind of precision difference is normal?

Unfortunately I never used joysticks yet so I can't help you but it sounds like your scripts are not set up to differentiate the various input phases? It's only detecting the full direction not any of the middle ground?

Impossible to help without seeing more code I think. $$anonymous$$aybe someone else knows though.

avatar image myingling · Nov 09, 2013 at 11:47 PM 0
Share

No, the $$anonymous$$otioninJoy is just a PS3-to-360 controller emulator. It seems to be working flawlessly; when I open Window's device manager it sees an Xbox 360 Game Controller and the Test tab shows all degrees of inputs properly.

Yes, the 0.014 bit shows on zero. It may be the remote, and I can create a "dead buffer" if needed. It appears under the Edit->Project Settings->Inputs that there are built-in dead ranges for each axis. It defaults to 0.001 and when I tested it to 0.1 the "zero position" of the controller now reads 0. When I tested at 0.01 it reads 0.005312143. I don't think that matters too much.

Honestly: that's all the code there is. I have an airplane with this controller attached and it prints these results. Since the appropriate axis are changing on the correct inputs I know I have them mapped right, but they're acting like binary inputs rather than scaled ones, which is my trouble.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by myingling · Nov 10, 2013 at 04:47 AM

Got the answer from somewhere else:

Turned out the input settings scale needed to be changed. I thought the defaults of the Gravity was 1000, Dead was 0.001 and Sensitivity was 1000. Someone has me change them to Gravity = 0, Dead = 0.19 and Sensitivity = 1 and things started working. I'm now playing with each, but this was my problem.

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

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

17 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

Related Questions

Creating an input manager that supports axis 0 Answers

How to get an axis without defining it in the InputManager 0 Answers

Problems with joystick / controller axes being 1/-1 "way too often" 1 Answer

New Input axis with Numpad Keys 2 Answers

Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 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