浏览代码

C#: Add `Basis.ScaledLocal`

LuoZhihao 3 月之前
父节点
当前提交
44f5974bb7
共有 1 个文件被更改,包括 14 次插入0 次删除
  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;
             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>
         /// <summary>
         /// Assuming that the matrix is a proper rotation matrix, slerp performs
         /// Assuming that the matrix is a proper rotation matrix, slerp performs
         /// a spherical-linear interpolation with another rotation matrix.
         /// a spherical-linear interpolation with another rotation matrix.