Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanded documentation for vector slide and project #83691

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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].
theraot marked this conversation as resolved.
Show resolved Hide resolved
[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 @@ -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>
Expand Down Expand Up @@ -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)
theraot marked this conversation as resolved.
Show resolved Hide resolved
{
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 @@ -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>
Expand Down Expand Up @@ -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)
{
Expand Down
Loading