diff options
author | Chaosus <chaosus89@gmail.com> | 2019-07-14 07:30:45 +0300 |
---|---|---|
committer | Chaosus <chaosus89@gmail.com> | 2019-07-20 12:59:41 +0300 |
commit | 6694c119d069d8ff8dc5290d38d2d33625f07807 (patch) | |
tree | 085f1fd73f885c29d417993d1c1a8ff0a3380bd9 /modules/mono/glue | |
parent | c317a3ce16a35b21d85b250a0e810526bb89db38 (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.cs | 6 |
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); |