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

RayCast2D and RayCast3D: warn to check is_colliding before get_collision_point and get_collision_normal #87414

Merged

Conversation

rburing
Copy link
Member

@rburing rburing commented Jan 20, 2024

Adds warnings to check is_colliding first, in the documentation of get_collision_point and get_collision_normal.

The warning is phrased in the positive, making no guarantees about what happens if is_colliding returns false. 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.

@Mickeon
Copy link
Contributor

Mickeon commented Jan 27, 2024

Also needs to be rebased. The part about global coordinates is handled more nicely in this PR, by being part of the same paragraph instead of a separate note.

@rburing rburing force-pushed the doc_warning_check_ray_collides branch from 22b7f18 to 8effd6b Compare March 14, 2024 10:35
@rburing rburing requested a review from Mickeon March 14, 2024 10:41
@akien-mga akien-mga merged commit cfe7bd0 into godotengine:master Mar 14, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RayCast3D doesn't update collision point when calling force_raycast_update()
5 participants