Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Analog stick rotation angle (2D aiming) in new Input System

Discussion in 'Input System' started by TimHellmann, Apr 26, 2021.

  1. TimHellmann

    TimHellmann

    Joined:
    Mar 6, 2011
    Posts:
    66
    Hey guys,

    is there a preferred solution to detect the rotation angle of an analog stick in the new input system? I want to make a 2D character aim towards the rotation of the analog stick (360° 2D aiming) and snap back to default when the stick is in its idle position.
    Edit: A better, perhaps integrated method than calculating from the Vector2 inputs, that is.

    AnalogStickIssue.png

    Thank you in advance for any helpful advice.
     
    Last edited: Apr 27, 2021
  2. Ouro17

    Ouro17

    Joined:
    Mar 9, 2017
    Posts:
    2
    Hello, did you find a solution? I'm trying to do it simply by
    Code (CSharp):
    1. Vector2.SignedAngle(Vector2.right, context.ReadValue<Vector2>());
    but them the Y axis is inverted.
    If I invert the Y axis, my X axis get also inverted by the angle...