Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
This question was closed Apr 14, 2016 at 01:42 AM by Hydropulse17 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Hydropulse17 · Apr 13, 2016 at 08:03 AM · rigidbodyinputmanageraddtorqueanalog360 controller

X-Axis inverted on 360 controller but not keyboard

I've been working on my game for a while without any interest in making it work with a controller, but by accident I discovered that the player could already use the controller, partially. I've been going through my scripts and changing the controls to the input buttons instead of accessing keys directly. Everything works with a controller now, except while holding left on the keyboard, the player rotates to the left as expected. On the controller, however, holding the analog stick left make the player rotate to the right, and vice versa. Here's my movement script, it makes for some really smooth space ship movement.

 public float accelerationForce = 10f;
 public float rotationForce = 3f;
 
 void MoveShip ()
     {
         float rotation = Input.GetAxis("Horizontal");
         float acceleration = Input.GetAxis("Vertical");
         GetComponent<Rigidbody>().AddTorque(0, 0, rotation * rotationForce * Time.deltaTime);
         GetComponent<Rigidbody>().AddForce(transform.up * acceleration * (accelerationForce * Time.deltaTime));                          
     }

I don't know if it is relevant, but my game is 3D, set up as 2D. Like, all of the object in the game have 3D models, but the camera is orthographic and all the action takes place at 0 on the z axis.

EDIT: Also possibly relevant, accelerationForce and rotationForce have been set to 300 & 200, respectively, in the inspector.

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

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by Eno-Khaon · Apr 13, 2016 at 08:40 AM

In the Input Manager --Edit>Project Settings>Input-- under the default listings, you will see two labeled "Horizontal"

One of them is for keyboard input (AD and left/right arrows) and the other is intended for analog input from a joystick/gamepad.

There is also a toggle to Invert directional controls, so correcting this should prove very simple.

Comment
Add comment · Show 2 · 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 Hydropulse17 · Apr 14, 2016 at 01:42 AM 1
Share

That was it, I never noticed the second version of each input label, so thanks for bringing them to my attention. I had to invert the second one, to un-invert it, which I find strange.

avatar image Cambesa Hydropulse17 · Sep 15, 2021 at 05:34 PM 0
Share

Same here but with an Xbox One controller where Y/Vertical had to be inverted!

Follow this Question

Answers Answers and Comments

46 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

Related Questions

Giving a ball "english" (side spin) 1 Answer

How to have a cube to fall on fixed rotation? 1 Answer

Can I limit the maximum acceleration applied by addTorque? 0 Answers

How to use left analog stick on Xbox 360 controller? 1 Answer

Flight code not reading throttle axis 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