RayCast2D and RayCast3D: warn to check is_colliding
before get_collision_point
and get_collision_normal
#87414
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds warnings to check
is_colliding
first, in the documentation ofget_collision_point
andget_collision_normal
.The warning is phrased in the positive, making no guarantees about what happens if
is_colliding
returnsfalse
. In that case, if using Godot Physics, the vectors will be zero if the ray never collided, or they will contain the values from the previous time when there was a collision, but I think this implementation detail is not worth documenting. (It may be worth adding an error for that case in the future.)Also moved some adjacent information from a note to the main text, since the main text was just incomplete without it.