Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

Python makes it look easy.

from math import pi
def angle_delta(current_angle, target_angle):
    current_angle %= 2*pi
    target_angle %= 2*pi
    delta = target_angle - current_angle
    if delta < -pi :
        return 2*pi + delta;
    if delta > pi :
        return delta - 2*pi
    return delta