summaryrefslogtreecommitdiff
path: root/modules/mono/glue/Managed/Files/Mathf.cs
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-01 12:05:18 +0200
committerGitHub <noreply@github.com>2019-06-01 12:05:18 +0200
commit3c4fab295b96c9bd852601531bf35c1ade56b54c (patch)
tree9adcec083a49ca4935ff70e1257bd492ca88df62 /modules/mono/glue/Managed/Files/Mathf.cs
parent64a88e8ef35d692f31d6114793468623c6756785 (diff)
parentc00427add34f505cff275ea33423f1053423d646 (diff)
Merge pull request #27789 from Giacom/move_towards
Added move_toward functions for float, Vector2 and Vector3
Diffstat (limited to 'modules/mono/glue/Managed/Files/Mathf.cs')
-rw-r--r--modules/mono/glue/Managed/Files/Mathf.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/mono/glue/Managed/Files/Mathf.cs b/modules/mono/glue/Managed/Files/Mathf.cs
index 8fb8730b88..2d8c63fe7f 100644
--- a/modules/mono/glue/Managed/Files/Mathf.cs
+++ b/modules/mono/glue/Managed/Files/Mathf.cs
@@ -210,6 +210,11 @@ namespace Godot
return a < b ? a : b;
}
+ public static real_t MoveToward(real_t from, real_t to, real_t delta)
+ {
+ return Abs(to - from) <= delta ? to : from + Sign(to - from) * delta;
+ }
+
public static int NearestPo2(int value)
{
value--;