diff options
Diffstat (limited to 'client/global.gd')
-rw-r--r-- | client/global.gd | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/client/global.gd b/client/global.gd index 647cac32..d660173a 100644 --- a/client/global.gd +++ b/client/global.gd @@ -350,10 +350,17 @@ static func interpolate_angle(current, target, dt): current = fmod(current, PI * 2) target = fmod(target, PI * 2) if abs(target - current) > PI: - if target < 0: - target += PI * 2 - else: - target -= PI * 2 + if target < 0: target += PI * 2 + else: target -= PI * 2 + return target + (current - target) * exp(-dt) + +# TODO not working in all cases yet but there was an attempt +static func interpolate_angle_closest_quarter(current, target, dt): + current = fmod(current, PI * 2) + target = fmod(target, PI * 2) + while abs(target - current) > PI / 4.: + if target - current < 0: target += PI / 2 + else: target -= PI / 2 return target + (current - target) * exp(-dt) func find_menu(node: Node) -> Menu: |