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 PaxForce · Mar 20, 2014 at 05:55 PM · inputaxisinputmanagergamepadaxes

Weird Input Manager behaviour

alt textI've created a simple multiplayer game and now I'm trying to set up my two gamepads. This is how my input manager looks like:

Axes

  • Name: Horizontal_P1

  • Type: Joystick

  • Axis: X axis

  • JoyNum: Joistick 1

  • ___

  • Name: Vertical_P1

  • Type: Joystick Axis

  • Axis: Y axis

  • JoyNum: Joistick 1

  • ___

  • Name: Horizontal_P2

  • Type: Joystick Axis

  • Axis: X axis

  • JoyNum: Joistick 2

  • ___

  • Name: Vertical_P2

  • Type: Joystick Axis

  • Axis: Y axis

  • JoyNum: Joistick 2

Here's a bit of my code from the Player_1 script:

 void FixedUpdate()
     {
         float _moveHorizontal = Input.GetAxis ("Horizontal_P1");
         float _moveVertical = Input.GetAxis ("Vertical_P1");
         
         Vector3 _movement = new Vector3(_moveHorizontal, 0.0f, _moveVertical);
         
         rigidbody.AddForce (_movement * _movementSpeed, ForceMode.Force);
     }

All the player gameObjects have a similar script attached.

And here come the problems:

  1. only one gameObject(Player_1) moves.

  2. ONLY on the x axis (only left and right).

Please help.

vert.png (10.4 kB)
horiz.png (17.4 kB)
Comment
Add comment · Show 9
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 sriram90 · Mar 20, 2014 at 05:58 PM 0
Share

Can you post some scripts, when you're tapping on joystick pad ?

avatar image sriram90 · Mar 20, 2014 at 06:25 PM 0
Share

Am not sure what's going on because of i dont have unity right now. Try to change your Force$$anonymous$$ode, Because Force$$anonymous$$ode.Force Adds continious force on rigidbody using mass. Try with acceleration force mode.

avatar image TykoX64 · Mar 20, 2014 at 07:40 PM 0
Share

Can you post a screenshot of your input setup? The problem could be that deadzones and input types could be mismatched.

avatar image TykoX64 · Mar 20, 2014 at 08:31 PM 1
Share

First, I would increase your dead value to something around 0.1 or 0.05 ish because joysticks rarely default back to 0 when you release them, rather they have some residual value as you saw earlier with 0.0107. I would also remove snap when using gamepads as it will feel weird to loose all acceleration immediateny when the stick is released.

Next I would do as sriram90 said and change the force to acceleration so see if that fixes things.

avatar image TykoX64 · Mar 20, 2014 at 08:56 PM 1
Share

What kind of gamepad are you using? I know that most gamepads are supported but the axes and butons can differ from gamepad to gamepad.

Show more comments

1 Reply

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

Answer by TykoX64 · Mar 21, 2014 at 03:19 AM

So the solution was to up the answer was to up the dead value for your gamepad input so that the smaller values were ignored since the gamepad joysticks almost never reset back to exact 0.

Second is to make sure what axis your gamepad is using, the default unity gamepad controls are set up for the Xbox 360 controller. The actual gamepad you are using may have funky button and axis setups. I'm not sure what the best way to find out exactly what buttons and axes do what in unity. If anyone knows a better way than just trying every possibility I'd love to know.

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

22 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

Related Questions

Custom Input manager problem 0 Answers

Input.GetAxisRaw 1 Answer

Change input axis values from code 2 Answers

Using Xbox gamepad triggers as keys instead of axis? 1 Answer

Mapping multiple controllers 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