summaryrefslogtreecommitdiff
path: root/core/math/transform_3d.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-18 12:35:14 +0200
committerGitHub <noreply@github.com>2021-06-18 12:35:14 +0200
commit3fc39954ec3473cc022af615c5eb8b1ba271e008 (patch)
tree90b2c8ccc77e6775b0fe9eae0037089ae77c0c48 /core/math/transform_3d.cpp
parent3e8620c2759e6a457ea48b159bd6664d8d98b272 (diff)
parentbd6ed3fb091d2d541f85e4152f0538088a3956db (diff)
Merge pull request #49638 from aaronfranke/multiply-transforms
Allow multiplying Transforms and Basis by numbers
Diffstat (limited to 'core/math/transform_3d.cpp')
-rw-r--r--core/math/transform_3d.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/math/transform_3d.cpp b/core/math/transform_3d.cpp
index a34d998dde..51766b39f4 100644
--- a/core/math/transform_3d.cpp
+++ b/core/math/transform_3d.cpp
@@ -190,6 +190,17 @@ Transform3D Transform3D::operator*(const Transform3D &p_transform) const {
return t;
}
+void Transform3D::operator*=(const real_t p_val) {
+ origin *= p_val;
+ basis *= p_val;
+}
+
+Transform3D Transform3D::operator*(const real_t p_val) const {
+ Transform3D ret(*this);
+ ret *= p_val;
+ return ret;
+}
+
Transform3D::operator String() const {
return "[X: " + basis.get_axis(0).operator String() +
", Y: " + basis.get_axis(1).operator String() +