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

Fix KinematicBody2D floor detection regression #45340

Closed

Conversation

pouleyKetchoupp
Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp commented Jan 21, 2021

These changes modify a specific part of #42576 that was skipping rest info checking when no collision occurred in the motion check.

Having this check back allows floor detection to be more reliable by checking for rest info consistently (#45259).

On the other hand, one-way collision needs another fix in order to avoid inconsistencies between motion check and rest info check that causes bugs like #25967, which was fixed by skipping the rest info check in this case. This is done by restoring valid_depth in rest info check and set it the same way as in motion check to make it work more consistently with one-way collision (other cases are not affected).

Also making minor changes in _rest_cbk_result in order to early exit by doing depth tests first, before extra calculations for normal checking.

This is tested on multiple use cases to make sure this PR doesn't revert a previous fix for KinematicBody2D:

Fixes #45259

These changes revert the part of godotengine#42576 that was skipping rest info
checking when no collision occurred in the motion check.

That allows to make floor detection consistent by checking for rest info
even if there was no collision during the motion (godotengine#45259).

On the other hand, one-way collision need another fix in order to avoid
inconsistencies between motion check and rest info check that causes
bugs like godotengine#25967. This is done by restoring valid_depth in rest info
check and set it the same way as in motion check.

Also making minor changes in _rest_cbk_result in order to early exit by
doing depth tests first, before extra calculations for normal checking.

Fixes godotengine#45259
@pouleyKetchoupp pouleyKetchoupp added bug topic:physics regression cherrypick:3.x Considered for cherry-picking into a future 3.x release labels Jan 21, 2021
@pouleyKetchoupp pouleyKetchoupp requested a review from a team January 21, 2021 01:19
@pouleyKetchoupp pouleyKetchoupp removed the request for review from AndreaCatania January 21, 2021 01:19
@pouleyKetchoupp pouleyKetchoupp added this to the 4.0 milestone Jan 21, 2021
@pouleyKetchoupp
Copy link
Contributor Author

Closing, as #45259 can be fixed with no regression by adjusting the safe margin in specific cases.

@akien-mga akien-mga added archived and removed cherrypick:3.x Considered for cherry-picking into a future 3.x release for pr meeting labels Jan 29, 2021
@pouleyKetchoupp pouleyKetchoupp deleted the fix-one-way-regression branch February 18, 2021 15:51
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.

2D platform physics collision jitter
3 participants