浏览代码

Merge pull request #83691 from theraot/slidedocs

Expanded documentation for vector slide and project
Rémi Verschelde 1 年之前
父节点
当前提交
9509a9e8dd

+ 4 - 2
doc/classes/Vector2.xml

@@ -315,7 +315,8 @@
 			<return type="Vector2" />
 			<return type="Vector2" />
 			<param index="0" name="b" type="Vector2" />
 			<param index="0" name="b" type="Vector2" />
 			<description>
 			<description>
-				Returns the result of projecting the vector onto the given vector [param b].
+				Returns a new vector resulting from projecting this vector onto the given vector [param b]. The resulting new vector is parallel to [param b]. See also [method slide].
+				[b]Note:[/b] If the vector [param b] is a zero vector, the components of the resulting new vector will be [constant @GDScript.NAN].
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reflect" qualifiers="const">
 		<method name="reflect" qualifiers="const">
@@ -357,7 +358,8 @@
 			<return type="Vector2" />
 			<return type="Vector2" />
 			<param index="0" name="n" type="Vector2" />
 			<param index="0" name="n" type="Vector2" />
 			<description>
 			<description>
-				Returns the result of sliding the vector along a plane defined by the given normal.
+				Returns a new vector resulting from sliding this vector along a line with normal [param n]. The resulting new vector is perpendicular to [param n], and is equivalent to this vector minus its projection on [param n]. See also [method project].
+				[b]Note:[/b] The vector [param n] must be normalized. See also [method normalized].
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="snapped" qualifiers="const">
 		<method name="snapped" qualifiers="const">

+ 4 - 2
doc/classes/Vector3.xml

@@ -299,7 +299,8 @@
 			<return type="Vector3" />
 			<return type="Vector3" />
 			<param index="0" name="b" type="Vector3" />
 			<param index="0" name="b" type="Vector3" />
 			<description>
 			<description>
-				Returns the result of projecting the vector onto the given vector [param b].
+				Returns a new vector resulting from projecting this vector onto the given vector [param b]. The resulting new vector is parallel to [param b]. See also [method slide].
+				[b]Note:[/b] If the vector [param b] is a zero vector, the components of the resulting new vector will be [constant @GDScript.NAN].
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reflect" qualifiers="const">
 		<method name="reflect" qualifiers="const">
@@ -350,7 +351,8 @@
 			<return type="Vector3" />
 			<return type="Vector3" />
 			<param index="0" name="n" type="Vector3" />
 			<param index="0" name="n" type="Vector3" />
 			<description>
 			<description>
-				Returns a new vector slid along a plane defined by the given normal.
+				Returns a new vector resulting from sliding this vector along a plane with normal [param n]. The resulting new vector is perpendicular to [param n], and is equivalent to this vector minus its projection on [param n]. See also [method project].
+				[b]Note:[/b] The vector [param n] must be normalized. See also [method normalized].
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="snapped" qualifiers="const">
 		<method name="snapped" qualifiers="const">

+ 9 - 3
modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs

@@ -492,7 +492,10 @@ namespace Godot
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// Returns this vector projected onto another vector <paramref name="onNormal"/>.
+        /// Returns a new vector resulting from projecting this vector onto the given vector <paramref name="onNormal"/>.
+        /// The resulting new vector is parallel to <paramref name="onNormal"/>.
+        /// See also <see cref="Slide(Vector2)"/>.
+        /// Note: If the vector <paramref name="onNormal"/> is a zero vector, the components of the resulting new vector will be <see cref="real_t.NaN"/>.
         /// </summary>
         /// </summary>
         /// <param name="onNormal">The vector to project onto.</param>
         /// <param name="onNormal">The vector to project onto.</param>
         /// <returns>The projected vector.</returns>
         /// <returns>The projected vector.</returns>
@@ -583,9 +586,12 @@ namespace Godot
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// Returns this vector slid along a plane defined by the given <paramref name="normal"/>.
+        /// Returns a new vector resulting from sliding this vector along a line with normal <paramref name="normal"/>.
+        /// The resulting new vector is perpendicular to <paramref name="normal"/>, and is equivalent to this vector minus its projection on <paramref name="normal"/>.
+        /// See also <see cref="Project(Vector2)"/>.
+        /// Note: The vector <paramref name="normal"/> must be normalized. See also <see cref="Normalized()"/>.
         /// </summary>
         /// </summary>
-        /// <param name="normal">The normal vector defining the plane to slide on.</param>
+        /// <param name="normal">The normal vector of the plane to slide on.</param>
         /// <returns>The slid vector.</returns>
         /// <returns>The slid vector.</returns>
         public readonly Vector2 Slide(Vector2 normal)
         public readonly Vector2 Slide(Vector2 normal)
         {
         {

+ 9 - 3
modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs

@@ -514,7 +514,10 @@ namespace Godot
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// Returns this vector projected onto another vector <paramref name="onNormal"/>.
+        /// Returns a new vector resulting from projecting this vector onto the given vector <paramref name="onNormal"/>.
+        /// The resulting new vector is parallel to <paramref name="onNormal"/>.
+        /// See also <see cref="Slide(Vector3)"/>.
+        /// Note: If the vector <paramref name="onNormal"/> is a zero vector, the components of the resulting new vector will be <see cref="real_t.NaN"/>.
         /// </summary>
         /// </summary>
         /// <param name="onNormal">The vector to project onto.</param>
         /// <param name="onNormal">The vector to project onto.</param>
         /// <returns>The projected vector.</returns>
         /// <returns>The projected vector.</returns>
@@ -626,9 +629,12 @@ namespace Godot
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// Returns this vector slid along a plane defined by the given <paramref name="normal"/>.
+        /// Returns a new vector resulting from sliding this vector along a plane with normal <paramref name="normal"/>.
+        /// The resulting new vector is perpendicular to <paramref name="normal"/>, and is equivalent to this vector minus its projection on <paramref name="normal"/>.
+        /// See also <see cref="Project(Vector3)"/>.
+        /// Note: The vector <paramref name="normal"/> must be normalized. See also <see cref="Normalized()"/>.
         /// </summary>
         /// </summary>
-        /// <param name="normal">The normal vector defining the plane to slide on.</param>
+        /// <param name="normal">The normal vector of the plane to slide on.</param>
         /// <returns>The slid vector.</returns>
         /// <returns>The slid vector.</returns>
         public readonly Vector3 Slide(Vector3 normal)
         public readonly Vector3 Slide(Vector3 normal)
         {
         {