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 AmasterAmaster · Jan 27, 2015 at 01:04 PM · controllerconsoleaxes

PS4 Analog Sticks Are Not Analog?

I have this weird situation happening to me when I attempt to use the PS4 controller with unity. Mainly with the axes of the control sticks (both the left and right control stick), they are registering as digital input instead of analog input. I set up the input manager correctly (I double checked that part), and I will put up the code here if anyone spots what I am doing wrong. I have also plugged in the PS4 controller to my windows 7 machine and the drivers that were installed seem to work fine (no calibration was needed) and unity has detected the controller with no problem.

The real problem begins here: Upon testing the input of the controller, I get this without touching the control sticks. Digital Problem

Here is the code for the axes:

 void Update()
     {
         //------------PS4 controller axises-----------------
         dPadX = Input.GetAxis("Dpad X");
         dPadY = Input.GetAxis("Dpad Y");
         leftAnalogX = Input.GetAxis("leftAnalogX");
         leftAnalogY = Input.GetAxis("leftAnalogY");
         rightAnalogX = Input.GetAxis("rightAnalogX");
         rightAnalogY = Input.GetAxis("rightAnalogY");
         
         if(dPadX < -0.1f)
         {
             Debug.Log("DPad: Going left");
         }
         
         if(dPadX > 0.1f)
         {
             Debug.Log("DPad: Going right");
         }
         
         if(dPadY < -0.1f)
         {
             Debug.Log("DPad: Going down");
         }
         
         if(dPadY > 0.1f)
         {
             Debug.Log("DPad: Going up");
         }
         
         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");
         }
     }


What am I doing wrong that is causing this problem?

digitalproblem.jpg (20.8 kB)
Comment
Add comment · Show 2
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 meat5000 ♦ · Jan 27, 2015 at 12:29 PM 1
Share

Using a figure of 0.1? Thats barely out of the deadzone.

Place an OnGUI routine in there, make a label and insert your axis variables to it. Observe directly on screen the values you are returning from the sticks without relying on discreets.

avatar image AmasterAmaster · Jan 27, 2015 at 10:11 PM 0
Share

The reason I have it set up like this is because I need the precision of 0.1.

I have the GUI labels set up and it shows this: alt text

It is getting the same results as the problem mentioned.

Here is the GUI code I am using:

 void OnGUI()
     {
         GUI.Label(new Rect(10, 0, 100, 30), "DPad X: " + dPadX);
         GUI.Label(new Rect(10, 40, 100, 30), "DPad Y: " + dPadY);
         GUI.Label(new Rect(10, 80, 100, 30), "leftAnalogX: " + leftAnalogX);
         GUI.Label(new Rect(10, 120, 100, 30), "leftAnalogY: " + leftAnalogY);
         GUI.Label(new Rect(10, 160, 100, 30), "rightAnalogX: " + rightAnalogX);
         GUI.Label(new Rect(10, 200, 100, 30), "rightAnalogY: " + rightAnalogY);
     }

But I will continue to work on this, and I am trying a few ideas to see if something works to get this controller working with Unity.

guilabel02.png (129.9 kB)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Controller Axes Rotational Input 2 Answers

game controller YES but not all axes are working 1 Answer

Using an Xbox 360 controller for Rotation 0 Answers

MMD How to export model and animations to Unity as 3rd person controller? 2 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