diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
index 90fdb14953c..7366760e3f0 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
@@ -119,31 +119,6 @@ namespace Godot
}
}
- ///
- /// The scale of this basis.
- ///
- /// Equivalent to the lengths of each column vector, but negative if the determinant is negative.
- public Vector3 Scale
- {
- readonly get
- {
- real_t detSign = Mathf.Sign(Determinant());
- return detSign * new Vector3
- (
- Column0.Length(),
- Column1.Length(),
- Column2.Length()
- );
- }
- set
- {
- value /= Scale; // Value becomes what's called "delta_scale" in core.
- Column0 *= value.x;
- Column1 *= value.y;
- Column2 *= value.z;
- }
- }
-
///
/// Access whole columns in the form of .
///
@@ -566,6 +541,21 @@ namespace Godot
return orthonormalizedBasis.GetQuaternion();
}
+ ///
+ /// Assuming that the matrix is the combination of a rotation and scaling,
+ /// return the absolute value of scaling factors along each axis.
+ ///
+ public readonly Vector3 GetScale()
+ {
+ real_t detSign = Mathf.Sign(Determinant());
+ return detSign * new Vector3
+ (
+ Column0.Length(),
+ Column1.Length(),
+ Column2.Length()
+ );
+ }
+
///
/// Returns the inverse of the matrix.
///
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
index c99d91bff1a..09e656af491 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
@@ -31,45 +31,6 @@ namespace Godot
///
public Vector2 origin;
- ///
- /// The rotation of this transformation matrix.
- ///
- /// Getting is equivalent to calling with the values of .
- public real_t Rotation
- {
- readonly get
- {
- return Mathf.Atan2(x.y, x.x);
- }
- set
- {
- Vector2 scale = Scale;
- x.x = y.y = Mathf.Cos(value);
- x.y = y.x = Mathf.Sin(value);
- y.x *= -1;
- Scale = scale;
- }
- }
-
- ///
- /// The scale of this transformation matrix.
- ///
- /// Equivalent to the lengths of each column vector, but Y is negative if the determinant is negative.
- public Vector2 Scale
- {
- readonly get
- {
- real_t detSign = Mathf.Sign(BasisDeterminant());
- return new Vector2(x.Length(), detSign * y.Length());
- }
- set
- {
- value /= Scale; // Value becomes what's called "delta_scale" in core.
- x *= value.x;
- y *= value.y;
- }
- }
-
///
/// Access whole columns in the form of .
/// The third column is the vector.
@@ -202,6 +163,23 @@ namespace Godot
return new Vector2(x.Dot(v), y.Dot(v));
}
+ ///
+ /// Returns the transform's rotation (in radians).
+ ///
+ public readonly real_t GetRotation()
+ {
+ return Mathf.Atan2(x.y, x.x);
+ }
+
+ ///
+ /// Returns the scale.
+ ///
+ public readonly Vector2 GetScale()
+ {
+ real_t detSign = Mathf.Sign(BasisDeterminant());
+ return new Vector2(x.Length(), detSign * y.Length());
+ }
+
///
/// Interpolates this transform to the other by .
///
@@ -210,11 +188,11 @@ namespace Godot
/// The interpolated transform.
public readonly Transform2D InterpolateWith(Transform2D transform, real_t weight)
{
- real_t r1 = Rotation;
- real_t r2 = transform.Rotation;
+ real_t r1 = GetRotation();
+ real_t r2 = transform.GetRotation();
- Vector2 s1 = Scale;
- Vector2 s2 = transform.Scale;
+ Vector2 s1 = GetScale();
+ Vector2 s2 = transform.GetScale();
// Slerp rotation
var v1 = new Vector2(Mathf.Cos(r1), Mathf.Sin(r1));
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
index 23f6d9ca04e..4f0a557e0af 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
@@ -124,11 +124,11 @@ namespace Godot
/// The interpolated transform.
public readonly Transform3D InterpolateWith(Transform3D transform, real_t weight)
{
- Vector3 sourceScale = basis.Scale;
+ Vector3 sourceScale = basis.GetScale();
Quaternion sourceRotation = basis.GetRotationQuaternion();
Vector3 sourceLocation = origin;
- Vector3 destinationScale = transform.basis.Scale;
+ Vector3 destinationScale = transform.basis.GetScale();
Quaternion destinationRotation = transform.basis.GetRotationQuaternion();
Vector3 destinationLocation = transform.origin;