[3.x] Fix Rayshape recovery in test_body_ray_separation #53453
Merged
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.
Based on partial backport from #51896, in addition to #46149 applied to ray shapes.
These changes improve Rayshape behavior for Godot Physics 2D and 3D when using move_and_slide with and without snapping.
Kinematic margin is now applied to ray shapes when handling snapping collision tests and separation raycasts to help getting consistent results in slopes and flat surfaces.
Recovery is calculated without the margin and a depth of 0 is still considered a collision to stabilize results when on flat surface.
Recovery depth takes into account the current recovery vector (just like test_body_motion) to fix jittering issues with multiple ray shapes due to applying too much recovery.
Fixes #34098 and #34663 in 3.x when using Godot Physics.
Also tested for regression in 2D physics tests demo project.
Doesn't affect anything outside of ray shapes in kinematic body.