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 ks13 · Nov 24, 2011 at 11:32 AM · joysticksetupaxes

Leaky Joystick Axes

Hello, i'm trying to add a Joystick Manager in my project, so to begin i made a simple testing script :

using UnityEngine; using System.Collections.Generic; using System.Collections;

public class JoyTest : MonoBehaviour {

 private List<KeyCode> joyButtons = new List<KeyCode>() {
                                         KeyCode.JoystickButton0,
                                         KeyCode.JoystickButton1,
                                         KeyCode.JoystickButton2,
                                         KeyCode.JoystickButton3,
                                         KeyCode.JoystickButton4,
                                         KeyCode.JoystickButton5,
                                         KeyCode.JoystickButton6,
                                         KeyCode.JoystickButton7,
                                         KeyCode.JoystickButton8,
                                         KeyCode.JoystickButton9,
                                         KeyCode.JoystickButton10,
                                         KeyCode.JoystickButton11,
                                         KeyCode.JoystickButton12,
                                         KeyCode.JoystickButton13,
                                         KeyCode.JoystickButton14,
                                         KeyCode.JoystickButton15,
                                         KeyCode.JoystickButton16,
                                         KeyCode.JoystickButton17,
                                         KeyCode.JoystickButton18,
                                         KeyCode.JoystickButton19};

 // Use this for initialization
 void Start () {
 
 }
 
 // Update is called once per frame
 void OnGUI () {
     int xPos = 0;
     int yPos = 0;
     int width = 500;
     int height = 500;
     Event e = Event.current;

     string[] tmp = Input.GetJoystickNames();
     string str = "";
     foreach (var single in tmp)
         str += single + "\n";
     str += "X = " + (Input.GetAxisRaw("Joystick X").ToString()) + " | Y = " + (Input.GetAxisRaw("Joystick Y").ToString()) + "\n";
     str += "X = " + (Input.GetAxisRaw("Joystick 3rd").ToString()) + " | Y = " + (Input.GetAxisRaw("Joystick 4th").ToString()) + "\n";
     str += "X = " + (Input.GetAxisRaw("Joystick 5th").ToString()) + " | Y = " + (Input.GetAxisRaw("Joystick 6th").ToString()) + "\n";
     str += "X = " + (Input.GetAxisRaw("Joystick 7th").ToString()) + " | Y = " + (Input.GetAxisRaw("Joystick 8th").ToString()) + "\n";
     str += "X = " + (Input.GetAxisRaw("Joystick 9th").ToString()) + " | Y = " + (Input.GetAxisRaw("Joystick 10th").ToString()) + "\n";
     foreach (var single in joyButtons)
         str += single.ToString() + " Down " + Input.GetKeyDown(single) + " Hold " + Input.GetKey(single) + " Up " + Input.GetKeyUp(single) + "\n";
     str += e.type;
     GUI.Label(new Rect(xPos, yPos, width, height), str);
 }</code></pre>

I'm using a Joystick similar to a PS3 one, except it's made by "free" a ISP where i live. Also, i'm using Unity 3.4.1f5.

The problem i'm encoutering is that some axes "leak" to other axes : When "analog" is activated The X axe is leaking to the 4th axe, meaning when X = 1, 4th axe = 1 too. Same leak from 4th axe to 5th axe. When "analog" is deactivated The X axe is still leaking to the 4th axe, but the 4th axe isn't leaking to the 5th. Which would be logic since it should be deactivated, but it isn't, even though the pad using the 4th axe is returning buttons, it's still returning the 4th axe too.

Is this due to the Joystick, or is this a Unity problem?

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 ks13 · Nov 25, 2011 at 01:51 PM 0
Share

Bumped....

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by wccrawford · Nov 25, 2011 at 02:26 PM

It sounds like a joystick problem to me.

Also, the singular is 'axis' and plural is 'axes'. (Pronounced 'ax-iss' and 'ax-ees'.)

Comment
Add comment · Show 8 · 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 ks13 · Nov 25, 2011 at 02:35 PM 0
Share

Yea, sorry for that, since i'm using french usually it kind of sticks... As for the problem, i'm trying out a XBox controller and i get the same problem. Though different, a few axes that are used by a pad react also to other pads. I really believe this is a Unity or a Driver problem. Not sure which one, but it still bothers me as i don't think Joystick Axes being in that state are usable in a game/program.

Can anyone test a Joystick with their Unity and tell me if they get the same results?

avatar image wccrawford · Nov 25, 2011 at 02:43 PM 0
Share

You probably meant to comment ins$$anonymous$$d of post a new answer. The format of this site causes a lot of people to do that.

Can you post a web-based game that shows the values so I can try it easily and I'll post results from my 360 gamepad and my ps3 gamepad?

avatar image ks13 · Nov 25, 2011 at 02:58 PM 0
Share

Was testing myself again... I'll try to get one usable build, but the one i'm using uses the code i posted above. It's simple but shows all buttons for one Joystick.

avatar image ks13 · Nov 25, 2011 at 03:34 PM 0
Share

Ok, i made a web-based build, but how do i post it here?

avatar image wccrawford · Nov 26, 2011 at 12:31 AM 0
Share

Host it on a website somewhere and just post a link here.

Show more comments

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How do you set up a 2nd joystick controller? 4 Answers

Why is my touch joystick "sticking"? 2 Answers

Custom Input manager problem 0 Answers

simple x-y joystick 0 Answers

How to make Lerpz Sidescroller work with iPhone Joystick? 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