• 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 ChronosMOT · Jan 03, 2014 at 10:21 PM · inputcontrollergetaxisxbox360

different behaviour of axis using xbox360 controller

I tried moving a cube to the values of "Horizontal" and "Vertical", and it worked with the standard settings. But the movement seemed to be restricted by a circle, while key input is restricted by a square.

I then changed the settings in the "key axis" to accept controller input and deleted the preset "controller axis". The result was a square restriction.

My question is why? I don't see any setting that could have this effect.

Thanks for the help

P.S: I really didn't know how to put this in one sentence for the headline. Sorry for the mess

Comment
Add comment · Show 1
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 ChronosMOT · Jan 03, 2014 at 10:24 PM 0
Share

Here is the code I'm using to move the cube

   void Update () {
     transform.position = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0);
   }

1 Reply

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

Answer by Leosori · Jan 04, 2014 at 06:38 PM

It's a design choice. You have circle with radius = 1, so you are getting a vector with a max. length of 1 in all directions. If you push the stick into a 'corner' you will get a vector like (~0.7, ~0.7) which has the length 1.

There a some gamepads and joysticks who will report (1, 1) in a corner, so depending on your application you may need to check for that.

The reason you are seeing a different behavior, if you change the predefined keyboard axes to joystick input, is that the sensitivity setting is pushing the real value towards the target value of +/- 1. For joysticks the default value is 1, but for keyboard it is 3. So you reach +/- 1 already with one third of movement with your stick.

Comment
Add comment · Show 3 · 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 ChronosMOT · Jan 06, 2014 at 12:49 AM 0
Share

that would make sense to me as well, but that's not happening. both times I used my xbox 360 controller the one way i got (~0.7, ~0.7), the other I got (1,1). That's what got me confused.

Same controller -> different results

Sorry if this wasn't clear

avatar image Leosori · Jan 06, 2014 at 11:22 AM 0
Share

ah, I skipped that part of your question. I just tested it myself and I can see the same behavior. The sensitivity setting is set to 3 for keyboard input and 1 for joysticks. It pushes the real value towards the target value. If you set it to 3, you can see that you reach +/- 1 with just a little movement of your stick, so you can still reach +/- 1 in the corners too.

I have added this part to my previous answer.

avatar image ChronosMOT · Jan 06, 2014 at 03:53 PM 0
Share

didn't notice that. Thank you

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

19 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

Related Questions

Remote user game pads stuck on X axis, locally fine. 1 Answer

360 Trigger Pressing both Triggers at the same time 1 Answer

Multiples x360 controller 1 Answer

How do I use an Xbox controller axis other than the left thumbstick? 0 Answers

PS4 Left Analog Vertical Not Working (Input.GetAxis("Vertical")) 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges