Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.


Discussion in 'Documentation' started by Baste, Dec 1, 2017.

  1. Baste


    Jan 24, 2013
    The documentation on this function is... confusing.

    There's two problems:
    1) "The angle returned is the signed acute clockwise angle between the two vectors. This means the smaller of the two possible angles between the two vectors is used. The result is never greater than 180 degrees or smaller than -180 degrees.

    Last I checked, "acute" angle means "less than 90 degrees". It might be that I've missed something, but your definition seems mutually exclusive? Unless what you're trying to do is to make up the term "signed acute", and then define it in the second sentence. Which is a mess.

    This would be a lot easier to read as a shorter explanation with examples:
    "The angle returned is the signed clockwise angle between the two vectors. The result is never greater than 180 degrees or smaller than -180 degrees.
    print(Vector2.SignedAngle(new Vector2(0, 1), new Vector2(0, 1)); //prints "90"
    print(Vector2.SignedAngle(new Vector2(1, 1), new Vector2(0, -1)); //prints "-135"

    2) Either the implementation is wrong, or the documentation is wrong. The documentation states that these are clockwise angles. But:
    Code (csharp):
    1. Vector2.SignedAngle(Vector2.up, Vector2.right); //gives -90
    2. Vector2.SignedAngle(Vector2.up, Vector2.left); //gives 90
    Which means that looking at the vectors from the standard 2D camera, the angles given are counterclockwise.
    I kinda get what's happening; Vector2.SignedAngle corresponds to Vector3.SignedAngle with the up-axis defined as Vector3.forward. Which is... a definition, sure. But that's not a clockwise angle! Unless I'm completely missing something, which might be the case.
  2. tigger


    Jan 8, 2013
    I'm somewhat new to Unity. Just noticed #2. Docs appear to be wrong.
  3. etzl


    Jun 22, 2018
    seems it is calculating from the second vector to the first vector that is the correct answer with clockwise angle
    Sab_Rango likes this.
  4. Baste


    Jan 24, 2013
    @jo-unity, somebody just posted about this. Any chance to get a confirmation from someone on what's supposed to be happening here? The documentation isn't very rigid, and by the intuitive definition, the implementation and documentation doesn't match.

    In laymans terms, the current implementation gives that the angle from 12 o' clock to 3 o' clock is -90, if the clock is a normal 2D sprite facing the camera.
  5. blackbrosg


    Apr 9, 2018
    i can't fix this error in unity 5.6
    Assets/MCR Creator/Assets/Scripts/car/CarAI.cs(115,28): error CS0117: `UnityEngine.Vector2' does not contain a definition for `SignedAngle'

    can u help me? thanks