-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Fix wrong collision reported on move_and_collide #59438
Fix wrong collision reported on move_and_collide #59438
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm this PR restores the behavior of the move_and_collide
method so that it doesn't generate collisions which come only from recovery. Moreover, it uses the same approach that is already implemented in test_move
. I have some refactoring ideas but those can wait; this is an improvement, restoring the expected behavior.
@reduz :I first suggested to add a parameter We can add his suggestion on this PR or on a follow up PR, and possibly only in 4.0. Let me know what's do you think about that. |
Oh, so But if that's the case, I suppose the documentation should be updated?
Wouldn't |
In the linked issues we see cases (mainly in user code) where recovery-only should not be reported as a collision, and I would guess this is the most common case. On the other hand there are cases where we do want recovery-only to be reported as a collision. One of those use cases (mainly in engine code) is improving floor detection when there is no snapping; this is already handled in this PR by not changing the internal However, another use case where you would want recovery-only to be reported as a collision is calling If you use |
Thanks! |
fix #59422
fix #59139
When a recover occurs, collisions are reported
to move_and_collide
, this is a useful change introduced to stabilise the movement inmove_and_slide
, but it's not something desired formove_and_collide
.As discussed with @reduz, there are 2 ways to solve this problem, the first is to remove the condition that report a collision when recovery occurs but this required to modify
test_body_motion
which is very sensitive and will remove the improvement mentioned above.This PR is the safest approach, it checks if
collision_safe_fraction < 1
(which means there were no collisions in motion) and only modifiesmove_and_collide
.Before:
After:
I tried the examples provided by @KoBeWi , the ones provided in the documentation, and custom ones.