From 8777c05817b77430d85a112f5c963d40131c95ba Mon Sep 17 00:00:00 2001 From: Theraot 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 @@ - 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]. @@ -357,7 +358,8 @@ - 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]. 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 @@ - 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]. @@ -350,7 +351,8 @@ - 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]. 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) } /// - /// Returns this vector projected onto another vector . + /// Returns a new vector resulting from projecting this vector onto the given vector . + /// The resulting new vector is parallel to . + /// See also . + /// Note: If the vector is a zero vector, the components of the resulting new vector will be . /// /// The vector to project onto. /// The projected vector. @@ -580,9 +583,12 @@ public readonly Vector2 Slerp(Vector2 to, real_t weight) } /// - /// Returns this vector slid along a plane defined by the given . + /// Returns a new vector resulting from sliding this vector along a line with normal . + /// The resulting new vector is perpendicular to , and is equivalent to this vector minus its projection on . + /// See also . + /// Note: The vector must be normalized. See also . /// - /// The normal vector defining the plane to slide on. + /// The normal vector of the plane to slide on. /// The slid vector. 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) } /// - /// Returns this vector projected onto another vector . + /// Returns a new vector resulting from projecting this vector onto the given vector . + /// The resulting new vector is parallel to . + /// See also . + /// Note: If the vector is a zero vector, the components of the resulting new vector will be . /// /// The vector to project onto. /// The projected vector. @@ -623,9 +626,12 @@ public readonly Vector3 Slerp(Vector3 to, real_t weight) } /// - /// Returns this vector slid along a plane defined by the given . + /// Returns a new vector resulting from sliding this vector along a plane with normal . + /// The resulting new vector is perpendicular to , and is equivalent to this vector minus its projection on . + /// See also . + /// Note: The vector must be normalized. See also . /// - /// The normal vector defining the plane to slide on. + /// The normal vector of the plane to slide on. /// The slid vector. public readonly Vector3 Slide(Vector3 normal) {