From 8777c05817b77430d85a112f5c963d40131c95ba Mon Sep 17 00:00:00 2001 From: Theraot <Theraot@gmail.com> Date: Fri, 20 Oct 2023 13:04:56 -0500 Subject: [PATCH] Expanded documentation for vector slide and project --- doc/classes/Vector2.xml | 6 ++++-- doc/classes/Vector3.xml | 6 ++++-- .../mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs | 12 +++++++++--- .../mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs | 12 +++++++++--- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 3fa7bb46fc20..e7c91daf3c18 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -315,7 +315,8 @@ <return type="Vector2" /> <param index="0" name="b" type="Vector2" /> <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> </method> <method name="reflect" qualifiers="const"> @@ -357,7 +358,8 @@ <return type="Vector2" /> <param index="0" name="n" type="Vector2" /> <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> </method> <method name="snapped" qualifiers="const"> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 83a8c6af7399..a48dfb1f87f7 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -299,7 +299,8 @@ <return type="Vector3" /> <param index="0" name="b" type="Vector3" /> <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> </method> <method name="reflect" qualifiers="const"> @@ -350,7 +351,8 @@ <return type="Vector3" /> <param index="0" name="n" type="Vector3" /> <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> </method> <method name="snapped" qualifiers="const"> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs index 4842dbc9afc8..099924b17437 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs @@ -489,7 +489,10 @@ public readonly Vector2 PosMod(Vector2 modv) } /// <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> /// <param name="onNormal">The vector to project onto.</param> /// <returns>The projected vector.</returns> @@ -580,9 +583,12 @@ public readonly Vector2 Slerp(Vector2 to, real_t weight) } /// <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> - /// <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> public readonly Vector2 Slide(Vector2 normal) { diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs index d26d4662a0d0..ea3f5f5d6a3f 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs @@ -511,7 +511,10 @@ public readonly Vector3 PosMod(Vector3 modv) } /// <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> /// <param name="onNormal">The vector to project onto.</param> /// <returns>The projected vector.</returns> @@ -623,9 +626,12 @@ public readonly Vector3 Slerp(Vector3 to, real_t weight) } /// <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> - /// <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> public readonly Vector3 Slide(Vector3 normal) {