summaryrefslogtreecommitdiff
path: root/modules/mono/glue
diff options
context:
space:
mode:
authorChaosus <chaosus89@gmail.com>2019-07-14 07:30:45 +0300
committerChaosus <chaosus89@gmail.com>2019-07-20 12:59:41 +0300
commit6694c119d069d8ff8dc5290d38d2d33625f07807 (patch)
tree085f1fd73f885c29d417993d1c1a8ff0a3380bd9 /modules/mono/glue
parentc317a3ce16a35b21d85b250a0e810526bb89db38 (diff)
Added lerp_angles built-in function
Co-authored-by: Xrayez <https://github.com/Xrayez> Co-authored-by: DleanJeans <https://github.com/DleanJeans>
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);