Improved lerp interpolation

This commit is contained in:
2024-02-16 12:51:05 +01:00
parent 2a53a731db
commit a374acc4f0
6 changed files with 16 additions and 6 deletions

10
client/math/Math.gd Normal file
View File

@ -0,0 +1,10 @@
class_name Math
static func damp(from: Variant, to: Variant, weight: float, smoothing: float = 0.75):
return lerp(from, to, 1 - exp(-smoothing * weight))
static func dampf(from: float, to: float, weight: float, smoothing: float = 0.75):
return lerpf(from, to, 1 - exp(-smoothing * weight))
static func damp_angle(from: float, to: float, weight: float, smoothing: float = 0.75):
return lerp_angle(from, to, 1 - exp(-smoothing * weight))