From 24e5d4635d50d01d78db48f0640948f6adaf67ff Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 7 Nov 2021 21:39:09 +0100 Subject: [PATCH] Add `Mathf.Frac` --- Source/Engine/Core/Math/Mathf.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Engine/Core/Math/Mathf.cs b/Source/Engine/Core/Math/Mathf.cs index 488c46777..21a800a51 100644 --- a/Source/Engine/Core/Math/Mathf.cs +++ b/Source/Engine/Core/Math/Mathf.cs @@ -539,6 +539,16 @@ namespace FlaxEngine return (float)Math.Sin(f); } + /// + /// Returns signed fractional part of a float. + /// + /// Floating point value to convert. + /// A float between [0 ; 1) for nonnegative input. A float between [-1; 0) for negative input. + public static float Frac(float value) + { + return value - (int)value; + } + /// /// Gradually changes a value towards a desired goal over time with smoothing. ///