Skip to content

Commit

Permalink
Merge pull request #83691 from theraot/slidedocs
Browse files Browse the repository at this point in the history
Expanded documentation for vector slide and project
  • Loading branch information
akien-mga committed Feb 26, 2024
2 parents 81f3d43 + 8777c05 commit 9509a9e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
6 changes: 4 additions & 2 deletions doc/classes/Vector2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down
6 changes: 4 additions & 2 deletions doc/classes/Vector3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down
12 changes: 9 additions & 3 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,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>
Expand Down Expand Up @@ -583,9 +586,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)
{
Expand Down
12 changes: 9 additions & 3 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,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>
Expand Down Expand Up @@ -626,9 +629,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)
{
Expand Down

0 comments on commit 9509a9e

Please sign in to comment.