Mathf.DeltaAngle

Switch to Manual

Declaration

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

Parameters

current The current angle in degrees.
target The target angle in degrees.

Returns

float A value between -179 and 180, in degrees.

Description

Calculates the shortest difference between two angles.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Prints 90 Debug.Log(Mathf.DeltaAngle(1080, 90)); } }

Did you find this page useful? Please give it a rating: