# Find range between two signed 180° angles

How can I find the angle between two angles that go from -180 to 180 degrees?

I would like to do :

if (angleDiff > 90)
{
// The angle is bigger than 90 degrees...
}


I tried subtracting them but that doesn't seem to work. Thank you

public static float DeltaAngle(float current, float target);

Description

Calculates the shortest difference between two given angles given in degrees.

So you can write...

if ( Mathf.Abs(Mathf.DeltaAngle(angleA, angleB)) > 90f ) { ... }


Don't forget to search for past answers and read the documentation when you have questions about common tasks like this. It's almost guaranteed you're not the first one to try to solve this problem.