diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 41836650cd7..86e3b1d118b 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -494,7 +494,7 @@
- Returns whether [code]x[/code] is a finite value, i.e. it is not [constant @GDScript.NAN], positive infinity, or negative infinity.
+ Returns whether [param x] is a finite value, i.e. it is not [constant @GDScript.NAN], positive infinity, or negative infinity.
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
index a2916d4ae8b..13a21ae8bc2 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
@@ -585,6 +585,16 @@ namespace Godot
return true;
}
+ ///
+ /// Returns if this is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public readonly bool IsFinite()
+ {
+ return _position.IsFinite() && _size.IsFinite();
+ }
+
///
/// Returns a larger that contains this and .
///
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
index 5d390a298de..5aa1622bf87 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
@@ -709,6 +709,16 @@ namespace Godot
);
}
+ ///
+ /// Returns if this basis is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public readonly bool IsFinite()
+ {
+ return Row0.IsFinite() && Row1.IsFinite() && Row2.IsFinite();
+ }
+
internal readonly Basis Lerp(Basis to, real_t weight)
{
Basis b = this;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
index 3f9e986f628..772b05a617d 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
@@ -439,6 +439,17 @@ namespace Godot
return Abs(a - b) < tolerance;
}
+ ///
+ /// Returns whether is a finite value, i.e. it is not
+ /// , positive infinite, or negative infinity.
+ ///
+ /// The value to check.
+ /// A for whether or not the value is a finite value.
+ public static bool IsFinite(real_t s)
+ {
+ return real_t.IsFinite(s);
+ }
+
///
/// Returns whether is an infinity value (either positive infinity or negative infinity).
///
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
index 42c6b0a37e3..9e5f7c4f9e0 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
@@ -204,6 +204,16 @@ namespace Godot
return begin - (segment * dist);
}
+ ///
+ /// Returns if this plane is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public readonly bool IsFinite()
+ {
+ return _normal.IsFinite() && Mathf.IsFinite(D);
+ }
+
///
/// Returns if is located above the plane.
///
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
index bd0dea0c1c0..10116e9fa4c 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
@@ -339,6 +339,16 @@ namespace Godot
return new Quaternion(-x, -y, -z, w);
}
+ ///
+ /// Returns if this quaternion is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public readonly bool IsFinite()
+ {
+ return Mathf.IsFinite(x) && Mathf.IsFinite(y) && Mathf.IsFinite(z) && Mathf.IsFinite(w);
+ }
+
///
/// Returns whether the quaternion is normalized or not.
///
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
index b0e0e75a342..1a8696d3bc5 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
@@ -100,6 +100,16 @@ namespace Godot
return newRect;
}
+ ///
+ /// Returns if this is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public bool IsFinite()
+ {
+ return _position.IsFinite() && _size.IsFinite();
+ }
+
///
/// Returns if this completely encloses another one.
///
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
index 756f71e5b2c..c99d91bff1a 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
@@ -270,6 +270,16 @@ namespace Godot
return inv;
}
+ ///
+ /// Returns if this transform is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public readonly bool IsFinite()
+ {
+ return x.IsFinite() && y.IsFinite() && origin.IsFinite();
+ }
+
///
/// Returns the transform with the basis orthogonal (90 degrees),
/// and normalized axis vectors (scale of 1 or -1).
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
index 39167bd1168..dee1e915120 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
@@ -139,6 +139,16 @@ namespace Godot
return new Transform3D(basisTr, basisTr * -origin);
}
+ ///
+ /// Returns if this transform is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public readonly bool IsFinite()
+ {
+ return basis.IsFinite() && origin.IsFinite();
+ }
+
///
/// Returns a copy of the transform rotated such that its
/// -Z axis (forward) points towards the position.
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
index 4c60080ee97..8af021ebc4a 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
@@ -333,6 +333,16 @@ namespace Godot
return new Vector2(1 / x, 1 / y);
}
+ ///
+ /// Returns if this vector is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public readonly bool IsFinite()
+ {
+ return Mathf.IsFinite(x) && Mathf.IsFinite(y);
+ }
+
///
/// Returns if the vector is normalized, and otherwise.
///
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
index fefdee33a50..35769e550b2 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
@@ -330,6 +330,16 @@ namespace Godot
return new Vector3(1 / x, 1 / y, 1 / z);
}
+ ///
+ /// Returns if this vector is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public readonly bool IsFinite()
+ {
+ return Mathf.IsFinite(x) && Mathf.IsFinite(y) && Mathf.IsFinite(z);
+ }
+
///
/// Returns if the vector is normalized, and otherwise.
///
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
index 3191e8adc06..ce346b67448 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
@@ -279,6 +279,16 @@ namespace Godot
return new Vector4(1 / x, 1 / y, 1 / z, 1 / w);
}
+ ///
+ /// Returns if this vector is finite, by calling
+ /// on each component.
+ ///
+ /// Whether this vector is finite or not.
+ public readonly bool IsFinite()
+ {
+ return Mathf.IsFinite(x) && Mathf.IsFinite(y) && Mathf.IsFinite(z) && Mathf.IsFinite(w);
+ }
+
///
/// Returns if the vector is normalized, and otherwise.
///