summaryrefslogtreecommitdiff
path: root/modules/mono/glue
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-20 13:37:13 +0200
committerGitHub <noreply@github.com>2019-07-20 13:37:13 +0200
commit60efd67034724f3563d46e9ff3fd2db34763535b (patch)
treed5dc6ee7c3c64f18cd94db98895c4a09bd7c5aa1 /modules/mono/glue
parent9d6b6dbd2fd61ede0030804332f9def112cf25e4 (diff)
parent6694c119d069d8ff8dc5290d38d2d33625f07807 (diff)
Merge pull request #30693 from Chaosus/lerp_angle
Added lerp_angle built-in function
Diffstat (limited to 'modules/mono/glue')
-rw-r--r--modules/mono/glue/Managed/Files/Mathf.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/mono/glue/Managed/Files/Mathf.cs b/modules/mono/glue/Managed/Files/Mathf.cs
index 2d8c63fe7f..6c1a51fcf9 100644
--- a/modules/mono/glue/Managed/Files/Mathf.cs
+++ b/modules/mono/glue/Managed/Files/Mathf.cs
@@ -185,6 +185,12 @@ namespace Godot
return from + (to - from) * weight;
}
+ public static real_t LerpAngle(real_t from, real_t to, real_t weight) {
+ real_t difference = (to - from) % Mathf.Tau;
+ real_t distance = ((2 * difference) % Mathf.Tau) - difference;
+ return from + distance * weight;
+ }
+
public static real_t Log(real_t s)
{
return (real_t)Math.Log(s);