Skip to content

Commit

Permalink
Merge pull request #87414 from rburing/doc_warning_check_ray_collides
Browse files Browse the repository at this point in the history
RayCast2D and RayCast3D: warn to check `is_colliding` before `get_collision_point` and `get_collision_normal`
  • Loading branch information
akien-mga committed Mar 14, 2024
2 parents 5cf38f8 + 8effd6b commit cfe7bd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions doc/classes/RayCast2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@
<return type="Vector2" />
<description>
Returns the normal of the intersecting object's shape at the collision point, or [code]Vector2(0, 0)[/code] if the ray starts inside the shape and [member hit_from_inside] is [code]true[/code].
[b]Note:[/b] Check that [method is_colliding] returns [code]true[/code] before calling this method to ensure the returned normal is valid and up-to-date.
</description>
</method>
<method name="get_collision_point" qualifiers="const">
<return type="Vector2" />
<description>
Returns the collision point at which the ray intersects the closest object. If [member hit_from_inside] is [code]true[/code] and the ray starts inside of a collision shape, this function will return the origin point of the ray.
[b]Note:[/b] This point is in the [b]global[/b] coordinate system.
Returns the collision point at which the ray intersects the closest object, in the global coordinate system. If [member hit_from_inside] is [code]true[/code] and the ray starts inside of a collision shape, this function will return the origin point of the ray.
[b]Note:[/b] Check that [method is_colliding] returns [code]true[/code] before calling this method to ensure the returned point is valid and up-to-date.
</description>
</method>
<method name="is_colliding" qualifiers="const">
Expand Down
5 changes: 3 additions & 2 deletions doc/classes/RayCast3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,14 @@
<return type="Vector3" />
<description>
Returns the normal of the intersecting object's shape at the collision point, or [code]Vector3(0, 0, 0)[/code] if the ray starts inside the shape and [member hit_from_inside] is [code]true[/code].
[b]Note:[/b] Check that [method is_colliding] returns [code]true[/code] before calling this method to ensure the returned normal is valid and up-to-date.
</description>
</method>
<method name="get_collision_point" qualifiers="const">
<return type="Vector3" />
<description>
Returns the collision point at which the ray intersects the closest object. If [member hit_from_inside] is [code]true[/code] and the ray starts inside of a collision shape, this function will return the origin point of the ray.
[b]Note:[/b] This point is in the [b]global[/b] coordinate system.
Returns the collision point at which the ray intersects the closest object, in the global coordinate system. If [member hit_from_inside] is [code]true[/code] and the ray starts inside of a collision shape, this function will return the origin point of the ray.
[b]Note:[/b] Check that [method is_colliding] returns [code]true[/code] before calling this method to ensure the returned point is valid and up-to-date.
</description>
</method>
<method name="is_colliding" qualifiers="const">
Expand Down

0 comments on commit cfe7bd0

Please sign in to comment.