diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-04 23:17:36 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-04 23:17:36 +0200 |
commit | b93beb93360257c1a2e1330dfb1a2f184c59b879 (patch) | |
tree | 70d51afde522250349078a8d6bd256aa876827d2 /client | |
parent | 656fdfc0baf4479fc1e1c30309c763e68e983520 (diff) | |
download | hurrycurry-b93beb93360257c1a2e1330dfb1a2f184c59b879.tar hurrycurry-b93beb93360257c1a2e1330dfb1a2f184c59b879.tar.bz2 hurrycurry-b93beb93360257c1a2e1330dfb1a2f184c59b879.tar.zst |
fix interpolate angle
Co-authored-by: lialenck <lialenck@protonmail.com>
Diffstat (limited to 'client')
-rw-r--r-- | client/global.gd | 5 |
1 files changed, 2 insertions, 3 deletions
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 |