From c00427add34f505cff275ea33423f1053423d646 Mon Sep 17 00:00:00 2001 From: Giacom Date: Sun, 7 Apr 2019 22:40:56 +0100 Subject: Added move_toward functions for float, Vector2 and Vector3 --- modules/mono/glue/Managed/Files/Mathf.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/mono/glue/Managed/Files/Mathf.cs') 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--; -- cgit v1.2.3