Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 /
  • Help Room /
avatar image
0
Question by Maxxus220 · Apr 20, 2021 at 09:32 PM · controllermenuinput.getaxisradialradial menu

Radial Menu and Controller Input

Hi, I'm using the right analog stick to control a radial menu. It gives me the correct angle, but when the stick is released it occasionally will return an angle approximately opposite of what it just was and rounded to the nearest quarter so 90, 270, 280, 0. I have the deadzones set to 0.2 on the analog stick, but I cant seem to get rid of the problem. I tried turning up the deadzones but that didn't help either.

 void Update()
     {
         if (Input.GetAxis("LeftTrigger") > 0)
         {
             menu.SetActive(true);
             TimeController.radialTime();
             control.x = Input.GetAxis("Horizontal2");
             control.y = Input.GetAxis("Vertical2");
             Vector2 norm = control.normalized;
             if (norm != Vector2.zero)
             {
                 float angle = Mathf.Atan2(norm.y, -norm.x) / Mathf.PI;
                 angle *= 180;
                 angle += 90f;
                 if (angle < 0)
                 {
                     angle += 360;
                 }
                 if(angle < 25.7 || angle > 334.3)
                 {
                     selection = 1;
                 }
                 else if(25.7 < angle  && angle < 77.1)
                 {
                     selection = 7;
                 }
                 else if(77.1 < angle && angle < 128.5)
                 {
                     selection = 6;
                 }
                 else if(128.5 < angle && angle < 180)
                 {
                     selection = 5;
                 }
                 else if(180 < angle && angle < 231.4)
                 {
                     selection = 4;
                 }
                 else if(231.4 < angle && angle < 282.8)
                 {
                     selection = 3;
                 }
                 else if(282.8 < angle && angle < 334.3)
                 {
                     selection = 2;
                 }
                 Debug.Log(angle);
                 wasActive = true;
             }
         }
         else
         {
             if(wasActive)
             {
                 player.setMode(selection);
                 wasActive = false;
             }
             menu.SetActive(false);
             TimeController.normalTime();
         }
     }
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

· Add your reply
  • Sort: 
avatar image
0

Answer by catman73atgaming · Mar 22 at 08:21 PM

Sorry to necro but did you ever figure this out @Maxxus220? Im having the same exact issue

Comment
Add comment · Show 1 · 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 Maxxus220 · Mar 22 at 08:34 PM 0
Share

It's been a while, but I looked back at what I did and it looks like I just handled the deadzone manually. So, something like if (control.magnitude > deadzone) where deadzone is just a float. Hope that helps!

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

166 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 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 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 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

Joystick Angle Problem 0 Answers

How to make pie menu options interact to OnMouseDown? 0 Answers

Joystick Axis not recognized when deployed to WebGL 1 Answer

XInput D-Pad and Triggers not working 0 Answers

Various questions, need help please. 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