From b93beb93360257c1a2e1330dfb1a2f184c59b879 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 4 Sep 2024 23:17:36 +0200 Subject: fix interpolate angle Co-authored-by: lialenck --- client/global.gd | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'client') diff --git a/client/global.gd b/client/global.gd index d02ce60c..d62f5413 100644 --- a/client/global.gd +++ b/client/global.gd @@ -374,9 +374,8 @@ static func interpolate(current, target, dt): 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 - current > PI: target -= PI * 2 + elif current - target > PI: current -= PI * 2 return target + (current - target) * exp(-dt) # TODO not working in all cases yet but there was an attempt -- cgit v1.2.3-70-g09d2