Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 AmasterAmaster · Jan 15, 2016 at 07:09 AM · unity 5inputcontrolleraxisjoystick

Gamecube Controller joystick axis does not work?

I am trying to get a Gamecube controller to work with Unity 5. I have connected the Gamecube controller to the Wii U adapter that is then connected to my laptop. The controller is calibrated correctly (according to windows 10) and I am using vjoy and/or a device called WUP-028 that gets the input. Most of the components of the controller work (mainly the buttons and the DPad), except the joystick axis (control stick, c-stick, and the analog L and R buttons (I can still get the regular L and R buttons as digital inputs)).

My question is where/how to get the axis on this joystick correctly? I am getting an issue where it is getting input, but it is either 1 or -1 (and I am looking for the range in-between those numbers). Here is the script I have that gets the controller inputs:

 using UnityEngine;
 using System.Collections;
 
 public class GameCubeController : MonoBehaviour
 {
     //GameCube control variables
     [Tooltip("The x-axis for the Control stick.")]
     public float leftAnalogX = 0f;
     [Tooltip("The y-axis for the Control stick.")]
     public float leftAnalogY = 0f;
     [Tooltip("The x-axis for the C-Stick stick.")]
     public float rightAnalogX = 0f;
     [Tooltip("The y-axis for the C-Stick stick.")]
     public float rightAnalogY = 0f;
     [Tooltip("The axis for the L Button.")]
     public float leftAnalogButton = 0f;
     [Tooltip("The axis for the R Button.")]
     public float rightAnalogButton = 0f;
     
     //Update is called once per frame
     void Update()
     {
         //------------GameCube controller axises-----------------
         leftAnalogX = Input.GetAxis("leftAnalogX");
         leftAnalogY = Input.GetAxis("leftAnalogY");
         rightAnalogX = Input.GetAxis("rightAnalogX");
         rightAnalogY = Input.GetAxis("rightAnalogY");
         leftAnalogButton = Input.GetAxis("leftAnalogButton");
         rightAnalogButton = Input.GetAxis("rightAnalogButton");
         
         if(leftAnalogX < -0.1f)
         {
             Debug.Log("leftAnalog: Going left");
         }
         
         if(leftAnalogX > 0.1f)
         {
             Debug.Log("leftAnalog: Going right");
         }
         
         if(leftAnalogY < -0.1f)
         {
             Debug.Log("leftAnalog: Going up");
         }
         
         if(leftAnalogY > 0.1f)
         {
             Debug.Log("leftAnalog: Going down");
         }
         
         if(rightAnalogX < -0.1f)
         {
             Debug.Log("rightAnalog: Going left");
         }
         
         if(rightAnalogX > 0.1f)
         {
             Debug.Log("rightAnalog: Going right");
         }
         
         if(rightAnalogY < -0.1f)
         {
             Debug.Log("rightAnalog: Going up");
         }
         
         if(rightAnalogY > 0.1f)
         {
             Debug.Log("rightAnalog: Going down");
         }
 
         if(leftAnalogButton > 0.1)
         {
             Debug.Log("L button has pressure");
         }
 
         if(rightAnalogButton > 0.1)
         {
             Debug.Log("R button has pressure");
         }
         
         //--------------GameCube controller buttons-------------
         if(Input.GetButtonDown("A_Button")) //Joystick button 0
         {
             Debug.Log("A button pressed");
         }
         
         if(Input.GetButtonDown("B_Button")) //Joystick button 1
         {
             Debug.Log("B button pressed");
         }
         
         if(Input.GetButtonDown("X_Button")) //Joystick button 2
         {
             Debug.Log("X button pressed");
         }
         
         if(Input.GetButtonDown("Y_Button")) //Joystick button 3
         {
             Debug.Log("Y button pressed");
         }
         
         if(Input.GetButtonDown("Z_Button")) //Joystick button 4
         {
             Debug.Log("Z button pressed");
         }
 
         if(Input.GetButtonDown("R_Button")) //Joystick button 5
         {
             Debug.Log("R button pressed");
         }
         
         if(Input.GetButtonDown("L_Button")) //Joystick button 6
         {
             Debug.Log("L button pressed");
         }
         
         if(Input.GetButtonDown("Start")) //Joystick button 7
         {
             Debug.Log("Start button pressed");
         }
 
         if(Input.GetButtonDown("DPad_Up")) //Joystick button 8
         {
             Debug.Log("DPad Up pressed");
         }
 
         if(Input.GetButtonDown("DPad_Down")) //Joystick button 9
         {
             Debug.Log("DPad Down pressed");
         }
 
         if(Input.GetButtonDown("DPad_Left")) //Joystick button 10
         {
             Debug.Log("DPad Left pressed");
         }
 
         if(Input.GetButtonDown("DPad_Right")) //Joystick button 11
         {
             Debug.Log("DPad Right pressed");
         }
     }
 }


Here is what issue I am experiencing when I enter play mode:

alt text

Here is what I have in the input manager. All six axis are similar to what you see here, the only diference is the name and the axis for each.

alt text

I have searched for answers to this problem for awhile now, and there is not much out there. There is one question on this site that addresses the Gamecube controller, but is not having the same problem as I am facing right now. Any help is appreciated and please let me know if there is any way to fix this problem.

gamecube-input-error.png (7.9 kB)
onejoystickaxisinputgamecube.png (10.7 kB)
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 AndMik · Apr 01, 2017 at 04:43 PM 0
Share

Hi! I'm sitting with this exact problem right now. I can get the buttons but not the axis. Did you find a solution to this? @AmasterAmaster

0 Replies

· Add your reply
  • Sort: 

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

41 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

Related Questions

360 Trigger Pressing both Triggers at the same time 1 Answer

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

Getting Joystick Input from Matricom G-Pad BX? 0 Answers

Controller Joystick Hold Delay Logic? 1 Answer

How to find Joystick Axis? 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