summaryrefslogtreecommitdiff
path: root/core/math/vector3i.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/vector3i.cpp')
-rw-r--r--core/math/vector3i.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/math/vector3i.cpp b/core/math/vector3i.cpp
index 167fa3221d..a82db7f7fc 100644
--- a/core/math/vector3i.cpp
+++ b/core/math/vector3i.cpp
@@ -48,6 +48,13 @@ int Vector3i::max_axis() const {
return x < y ? (y < z ? 2 : 1) : (x < z ? 2 : 0);
}
+Vector3i Vector3i::clamp(const Vector3i &p_min, const Vector3i &p_max) const {
+ return Vector3i(
+ CLAMP(x, p_min.x, p_max.x),
+ CLAMP(y, p_min.y, p_max.y),
+ CLAMP(z, p_min.z, p_max.z));
+}
+
Vector3i::operator String() const {
return (itos(x) + ", " + itos(y) + ", " + itos(z));
}