Browse Source

Merge pull request #107300 from beicause/cs-add-basis-scaled-local

C#: Add `Basis.ScaledLocal`
Thaddeus Crews 3 months ago
parent
commit
dddaba29ee
1 changed files with 14 additions and 0 deletions
  1. 14 0
      modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs

+ 14 - 0
modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs

@@ -717,6 +717,20 @@ namespace Godot
             return b;
         }
 
+        /// <summary>
+        /// Returns this basis with each axis scaled by the corresponding component in the given <paramref name="scale"/>. The basis matrix's columns are multiplied by <paramref name="scale"/>'s components. This operation is a local scale (relative to self).
+        /// </summary>
+        /// <param name="scale">The scale to introduce.</param>
+        /// <returns>The scaled basis matrix.</returns>
+        public readonly Basis ScaledLocal(Vector3 scale)
+        {
+            Basis b = this;
+            b.Row0 *= scale;
+            b.Row1 *= scale;
+            b.Row2 *= scale;
+            return b;
+        }
+
         /// <summary>
         /// Assuming that the matrix is a proper rotation matrix, slerp performs
         /// a spherical-linear interpolation with another rotation matrix.