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 /
This question was closed Jun 23, 2017 at 03:21 PM by hexagonius for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by Doghelmer · Mar 18, 2015 at 06:00 PM · rotationinputquaternionjoystickgamepad

How to get smooth analog joystick rotation without "snapping"?

So, my basic problem is this: I can't seem to make Unity detect small deviations in joystick movement around the north, south, east and west corners.

To elaborate: I have a simple bit of code in place to rotate my top-down 2D character using the right analog stick of a gamepad:

 float angle = Mathf.Atan2(Input.GetAxis("Joy1 Horizontal"), Input.GetAxis("Joy1 Vertical")) * Mathf.Rad2Deg; 
 myObject.transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle));

However, I noticed that when I move the joystick's angle anywhere close to the north, south, east or west directions, the character would "snap" to that direction. For example, if I point directly north so that my horizontal and vertical output is 0,1, and then move the joystick slightly to the east or west, my output remains at 0,1 for a few degrees. I would like for ANY small amount of joystick movement to be detected, to create a smoother feel for the player.

Currently, I have the sensitivity for my two axes set to 1, and my dead zone set to 0.001 (which is probably way too low), though I've played around with these values extensively to no avail. There is no problem with the physical joystick itself-- the snapping I've mentioned does not occur in certain similar games that I've tested.

Any ideas? It seems like this must be a common issue for anyone doing a game that relies on joystick aiming.

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

2 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by Doghelmer · Mar 20, 2015 at 07:26 AM

Upon doing some more research, I found a good solution here:

https://web.archive.org/web/20130418234531/http://www.gamasutra.com/blogs/JoshSutphin/20130416/190541/Doing_Thumbstick_Dead_Zones_Right.php

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 RationalCommander · Jun 23, 2017 at 03:17 PM 0
Share

I have used the best way as described here and it still keeps snapping. I tried to do it at least 10 different ways, they all result in the same snapping. If you know the solution by now, please share.

Thank you

avatar image
0

Answer by Guy_Yome · Apr 04, 2016 at 04:11 AM

I know this post is old, but I programmed a good solution that fixes the precision problem on the analog joystick. The problem on those is that the sensitivity range is not in a circle but in a square. I did not find a solution online so I made myself one that smoothly converts a square analog to a circle analog.

If you still wanna see it, just tell me. ( I need to translate the code if I wanna show it to you ).

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 wafer23 · Jun 23, 2017 at 01:55 AM 0
Share

can u please share the solution

avatar image RationalCommander · Jun 23, 2017 at 03:10 PM 0
Share

please do, thank you

avatar image Arcatar · Mar 26, 2019 at 01:52 AM 0
Share

Hi, I know it's been like 3 years, but I'd really like to know how you went about avoiding deadzone snapping. It has been burning my brain for the past 3 days. Godspeed.

Follow this Question

Answers Answers and Comments

26 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

Related Questions

Joystick movement conversion to angle doesn't work anymore in C# 1 Answer

Rotate Locally Player Towards Joystick/Axis Input 1 Answer

Getting ScrollWheel/Joystick Direction w/ InputSystem 0 Answers

Rotation of a object depending on where the joystick is facing 1 Answer

Keyboard/Joystick Inputs Do Not Work until Mouse Clicked 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