-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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 multiple issues with one-way collisions #42574
Conversation
2c3d44b
to
1696c90
Compare
@madadam Did you test it with or without the patch from this comment ? |
I've checked the changes carefully. I don't see anything fishy and I understand the rationale of most of them. I've also tested the 3.2 version of this PR on my own game, which doesn't use one-way much, but also as a way to spot potential regressions or relevant behavior changes in the general behavior of body collisions. Everything seems alright. So I'm already giving my approval, but I'd like to see a project with heavy use of one-way collisions running with this changes, to confirm for good that the changes work as expected. |
Last time I tested these changes I noticed it introduced a bug in the 3.2 branch as I noted here: #36280 (comment) Is that bug still here? |
I think this is a bug in your project, if you reset the excessive |
The excessive Even if the bug only showed up with an "excessive" value, it is still a bug either way that does not show up before this change. |
Please fill then an issue for that what you think is »obvious bug to fix«. I can't reproduce it. |
I'm not sure an issue should be created for a bug introduced in a pull request that has not been merged yet. I've added a new version of the test project so that it more easily shows up. The only changes are that the KinematicBody2D moves with a vertical velocity of 3000 instead of 1000, and the |
I don't think this is a reasonable speed, indeed now the kinematic body jumps at the one way collision |
1696c90
to
6ca939b
Compare
I think that isn't right, it should be one way collision... |
@capnm The Note: |
For comparison, here are the results on the same tests for KinematicBody2D on other versions of the code. 3.2.3 stable Body angle 0, Platform size 64: Body angle 45, Platform size 64: Body angle 45, Platform size 32: This PR without the threshold change on normal checks Body angle 0, Platform size 64: Body angle 45, Platform size 64: Body angle 45, Platform size 32: |
For RigidBodies, uses the collision normal determined by relative motion to determine whether or not a one-way collision has occurred. For KinematicBodies, performs additional checks to ensure a one-way collision has occurred, and averages the recovery step over all collision shapes. Co-authored-by: Sergej Gureev <[email protected]>
d73e372
to
7653b8c
Compare
Updated to include:
|
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.
1. Note: I've used `CMP_EPSILON` to avoid creating another hard-coded constant.
That works! It's a lower tolerance value, but the same tests pass so it seems fine.
Given this PR is now fully tested and doesn't produce any obvious regression, I think it's finally ready to go :)
Thanks a ton to everyone involved! |
@Rhathe Please test your use cases again to see if some of them are still a problem. If it's the case, I would encourage you to open new issues, clearly stating what your use case is and what the expected behavior is. #42574 (comment) #42574 (comment) |
Will this fix all jittery issues (fluctuating velocity.y) with using move_and_slide on tilemaps (one way and not one way), i.e. with this patch can we safely stop having to put multiple raycasts on our nodes because is_on_floor() fails to return the correct value every other frame? Thanks in anticipation of good news :) |
@chucklepie This PR fixes some visible jittering issues, but it's difficult to guarantee it will fix any case of is_on_floor() being inconsistent. Feel free to point out a specific issue or open one with your use case and we'll check if it's already fixed. |
This is a salvage of #36280, because, despite the original author's decision to close #36280 in favour of #38471, #38471 does not solve all the issues that were solved by #36280.
This PR does a few things:
I have made some slight changes to the original PR to minimise the necessary changes and make this PR easy to review. I have also made the original author a co-author of the commit.
I have tested and confirmed that this PR fixes the following issues:
Fixes #25732
Fixes #25967
Fixes #28794
Fixes #34242
Fixes #35776
Fixes #40006
Fixes #42175
Fixes #43266
Note: #36280 claimed to fix other issues too. However, I found that several of these issues were already fixed (so I have updated them accordingly), or are actually not fixed by this PR.
Edit: Updated to remove the change that caused the bug reported by @Rhathe.
Edit: Updated to fix the bugs identified by @Rhathe here and here.
Edit: Updated to fix #43266, which is the same bug identified by @AttackButton here.